Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pkg/commands/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/spf13/cobra"

"github.com/golangci/golangci-lint/internal/cache"
"github.com/golangci/golangci-lint/pkg/exitcodes"
"github.com/golangci/golangci-lint/pkg/fsutils"
"github.com/golangci/golangci-lint/pkg/logutils"
)
Expand Down Expand Up @@ -51,7 +52,7 @@ func (e *Executor) executeCleanCache(_ *cobra.Command, args []string) {
e.log.Fatalf("Failed to remove dir %s: %s", cacheDir, err)
}

os.Exit(0)
os.Exit(exitcodes.Success)
}

func (e *Executor) executeCacheStatus(_ *cobra.Command, args []string) {
Expand All @@ -66,7 +67,7 @@ func (e *Executor) executeCacheStatus(_ *cobra.Command, args []string) {
fmt.Fprintf(logutils.StdOut, "Size: %s\n", fsutils.PrettifyBytesCount(cacheSizeBytes))
}

os.Exit(0)
os.Exit(exitcodes.Success)
}

func dirSizeBytes(path string) (int64, error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/commands/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ func (e *Executor) executePathCmd(_ *cobra.Command, args []string) {
}

fmt.Println(usedConfigFile)
os.Exit(0)
os.Exit(exitcodes.Success)
}
3 changes: 2 additions & 1 deletion pkg/commands/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/fatih/color"
"github.com/spf13/cobra"

"github.com/golangci/golangci-lint/pkg/exitcodes"
"github.com/golangci/golangci-lint/pkg/lint/linter"
"github.com/golangci/golangci-lint/pkg/logutils"
)
Expand Down Expand Up @@ -93,5 +94,5 @@ func (e *Executor) executeLintersHelp(_ *cobra.Command, args []string) {
fmt.Fprintf(logutils.StdOut, "%s: %s\n", color.YellowString(p), strings.Join(linterNames, ", "))
}

os.Exit(0)
os.Exit(exitcodes.Success)
}
3 changes: 2 additions & 1 deletion pkg/commands/linters.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/fatih/color"
"github.com/spf13/cobra"

"github.com/golangci/golangci-lint/pkg/exitcodes"
"github.com/golangci/golangci-lint/pkg/lint/linter"
)

Expand Down Expand Up @@ -48,5 +49,5 @@ func (e *Executor) executeLinters(_ *cobra.Command, args []string) {
color.Red("\nDisabled by your configuration linters:\n")
printLinterConfigs(disabledLCs)

os.Exit(0)
os.Exit(exitcodes.Success)
}
3 changes: 2 additions & 1 deletion pkg/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ import (
"github.com/spf13/pflag"

"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/exitcodes"
"github.com/golangci/golangci-lint/pkg/logutils"
)

func (e *Executor) persistentPreRun(_ *cobra.Command, _ []string) {
if e.cfg.Run.PrintVersion {
fmt.Fprintf(logutils.StdOut, "golangci-lint has version %s built from %s on %s\n", e.version, e.commit, e.date)
os.Exit(0)
os.Exit(exitcodes.Success)
}

runtime.GOMAXPROCS(e.cfg.Run.Concurrency)
Expand Down
3 changes: 2 additions & 1 deletion pkg/config/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/mitchellh/go-homedir"
"github.com/spf13/viper"

"github.com/golangci/golangci-lint/pkg/exitcodes"
"github.com/golangci/golangci-lint/pkg/fsutils"
"github.com/golangci/golangci-lint/pkg/logutils"
"github.com/golangci/golangci-lint/pkg/sliceutil"
Expand Down Expand Up @@ -87,7 +88,7 @@ func (r *FileReader) parseConfig() error {

if r.cfg.InternalTest { // just for testing purposes: to detect config file usage
fmt.Fprintln(logutils.StdOut, "test")
os.Exit(0)
os.Exit(exitcodes.Success)
}

return nil
Expand Down