diff --git a/tools/sggolangcilint/golangci.fix.yml b/tools/sggolangcilint/golangci.fix.yml deleted file mode 100644 index 3db3cc81..00000000 --- a/tools/sggolangcilint/golangci.fix.yml +++ /dev/null @@ -1,48 +0,0 @@ -run: - timeout: 10m - allow-serial-runners: true - skip-dirs: - - node_modules - -issues: - fix: true - -linters: - disable-all: true - enable: - # Check package import order and make it always deterministic. - # [fast: true, auto-fix: true] - - gci - - # Check if comments end in a period. - # [fast: true, auto-fix: true] - - godot - - # Check whether code was gofumpt-ed. - # [fast: true, auto-fix: true] - - gofumpt - - # Find commonly misspelled English words in comments. - # [fast: true, auto-fix: true] - - misspell - - # Reports direct reads from proto message fields when getters should be used. - # [fast: false, auto-fix: true] - - protogetter - - # Detect leading and trailing whitespace. - # [fast: true, auto-fix: true] - - whitespace - -linters-settings: - gofumpt: - extra-rules: true - - misspell: - locale: US - ignore-words: - - cancelled - - cancelling - - protogetter: - skip-any-generated: true diff --git a/tools/sggolangcilint/golangci.yml b/tools/sggolangcilint/golangci.yml index 1ecc0234..ab1eef5f 100644 --- a/tools/sggolangcilint/golangci.yml +++ b/tools/sggolangcilint/golangci.yml @@ -1,6 +1,5 @@ run: timeout: 10m - allow-parallel-runners: true skip-dirs: - node_modules diff --git a/tools/sggolangcilint/tools.go b/tools/sggolangcilint/tools.go index 9211777f..e0131769 100644 --- a/tools/sggolangcilint/tools.go +++ b/tools/sggolangcilint/tools.go @@ -23,9 +23,6 @@ const ( //go:embed golangci.yml var DefaultConfig []byte -//go:embed golangci.fix.yml -var defaultFixConfig []byte - func Command(ctx context.Context, args ...string) *exec.Cmd { sg.Deps(ctx, PrepareCommand) return sg.Command(ctx, sg.FromBinDir(name), args...) @@ -35,10 +32,6 @@ func defaultConfigPath() string { return sg.FromToolsDir(name, ".golangci.yml") } -func defaultFixConfigPath() string { - return sg.FromToolsDir(name, ".golangci.fix.yml") -} - func CommandInDirectory(ctx context.Context, directory string, args ...string) *exec.Cmd { configPath := filepath.Join(directory, ".golangci.yml") if _, err := os.Lstat(configPath); errors.Is(err, os.ErrNotExist) { @@ -48,7 +41,7 @@ func CommandInDirectory(ctx context.Context, directory string, args ...string) * if directory == sg.FromSageDir() { excludeArg = append(excludeArg, "--exclude", "(is a global variable|is unused)") } - cmdArgs := append([]string{"run", "-c", configPath}, args...) + cmdArgs := append([]string{"run", "--allow-parallel-runners", "-c", configPath}, args...) cmd := Command(ctx, append(cmdArgs, excludeArg...)...) cmd.Dir = directory return cmd @@ -88,7 +81,7 @@ func Fix(ctx context.Context, args ...string) error { if d.IsDir() || d.Name() != "go.mod" { return nil } - cmd := Command(ctx, append([]string{"run", "-c", defaultFixConfigPath(), "--fix"}, args...)...) + cmd := Command(ctx, append([]string{"run", "--allow-serial-runners", "-c", defaultConfigPath(), "--fix"}, args...)...) cmd.Dir = filepath.Dir(path) commands = append(commands, cmd) return cmd.Start() @@ -130,12 +123,5 @@ func PrepareCommand(ctx context.Context) error { if err := os.MkdirAll(filepath.Dir(configPath), 0o755); err != nil { return err } - if err := os.WriteFile(configPath, DefaultConfig, 0o600); err != nil { - return err - } - fixConfigPath := defaultFixConfigPath() - if err := os.MkdirAll(filepath.Dir(fixConfigPath), 0o755); err != nil { - return err - } - return os.WriteFile(fixConfigPath, defaultFixConfig, 0o600) + return os.WriteFile(configPath, DefaultConfig, 0o600) }