Browse Source

Infra: use customized goimports (#949)

Loyalsoldier 4 years ago
parent
commit
0fe129de65
2 changed files with 4 additions and 2 deletions
  1. 1 1
      format.go
  2. 3 1
      infra/vformat/main.go

+ 1 - 1
format.go

@@ -1,4 +1,4 @@
 package core
 
-//go:generate go install -v golang.org/x/tools/cmd/goimports@latest
+//go:generate go install -v github.com/v2fly/tools/cmd/goimports@latest
 //go:generate go run ./infra/vformat/

+ 3 - 1
infra/vformat/main.go

@@ -154,7 +154,8 @@ func main() {
 		filename := filepath.Base(path)
 		if strings.HasSuffix(filename, ".go") &&
 			!strings.HasSuffix(filename, ".pb.go") &&
-			!strings.Contains(dir, filepath.Join("testing", "mocks")) {
+			!strings.Contains(dir, filepath.Join("testing", "mocks")) &&
+			!strings.Contains(path, filepath.Join("main", "distro", "all", "all.go")) {
 			rawFilesSlice = append(rawFilesSlice, path)
 		}
 
@@ -171,6 +172,7 @@ func main() {
 
 	goimportsArgs := []string{
 		"-w",
+		"-r",
 		"-local", "github.com/v2fly/v2ray-core",
 	}