aboutsummaryrefslogtreecommitdiffstats
path: root/build/codeformat
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2022-10-16 10:11:17 +0200
committerGitHub <noreply@github.com>2022-10-16 16:11:17 +0800
commit0647df3e831c320436d42a5572a6ec6a9d23d8b1 (patch)
treefde6e41c5e353dc0fe535fa30875f00b4462a42c /build/codeformat
parent9fb251fb6fa2bb857bb8f5ae27f06c9d597bc1eb (diff)
downloadgitea-0647df3e831c320436d42a5572a6ec6a9d23d8b1.tar.gz
gitea-0647df3e831c320436d42a5572a6ec6a9d23d8b1.zip
Simplify fmt-check (#21458)
`fmt-check` now simply does `fmt` before and relies on `git diff` like other checks like 'tidy-check' already do, so we can remove the argument in the tool that handles printing changed files. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'build/codeformat')
-rw-r--r--build/codeformat/formatimports.go7
1 files changed, 1 insertions, 6 deletions
diff --git a/build/codeformat/formatimports.go b/build/codeformat/formatimports.go
index 5d051b2726..1076e3a0d1 100644
--- a/build/codeformat/formatimports.go
+++ b/build/codeformat/formatimports.go
@@ -7,7 +7,6 @@ package codeformat
import (
"bytes"
"errors"
- "fmt"
"io"
"os"
"sort"
@@ -159,7 +158,7 @@ func formatGoImports(contentBytes []byte) ([]byte, error) {
}
// FormatGoImports format the imports by our rules (see unit tests)
-func FormatGoImports(file string, doChangedFiles, doWriteFile bool) error {
+func FormatGoImports(file string, doWriteFile bool) error {
f, err := os.Open(file)
if err != nil {
return err
@@ -183,10 +182,6 @@ func FormatGoImports(file string, doChangedFiles, doWriteFile bool) error {
return nil
}
- if doChangedFiles {
- fmt.Println(file)
- }
-
if doWriteFile {
f, err = os.OpenFile(file, os.O_TRUNC|os.O_WRONLY, 0o644)
if err != nil {