parent
6d786b50ae
commit
5e54b3334e
@ -82,6 +82,7 @@ func NewExecutor(version, commit, date string) *Executor {
|
|||||||
e.initLinters()
|
e.initLinters()
|
||||||
e.initConfig()
|
e.initConfig()
|
||||||
e.initCompletion()
|
e.initCompletion()
|
||||||
|
e.initVersion()
|
||||||
|
|
||||||
// init e.cfg by values from config: flags parse will see these values
|
// init e.cfg by values from config: flags parse will see these values
|
||||||
// like the default ones. It will overwrite them only if the same option
|
// like the default ones. It will overwrite them only if the same option
|
||||||
|
17
pkg/commands/version.go
Normal file
17
pkg/commands/version.go
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package commands
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (e *Executor) initVersion() {
|
||||||
|
versionCmd := &cobra.Command{
|
||||||
|
Use: "version",
|
||||||
|
Short: "Version",
|
||||||
|
Run: func(cmd *cobra.Command, _ []string) {
|
||||||
|
cmd.Printf("golangci-lint has version %s built from %s on %s\n", e.version, e.commit, e.date)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
e.rootCmd.AddCommand(versionCmd)
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user