Skip to content

Commit 947cc95

Browse files
committed
Simplify version output and remove verbose config message
1 parent cfbdb2b commit 947cc95

3 files changed

Lines changed: 4 additions & 14 deletions

File tree

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ builds:
2222
flags:
2323
- -trimpath
2424
ldflags:
25-
- -s -w -X github.com/obay/hscli/cmd.version={{.Version}} -X github.com/obay/hscli/cmd.commit={{.Commit}} -X github.com/obay/hscli/cmd.buildDate={{.Date}}
25+
- -s -w -X github.com/obay/hscli/cmd.version={{.Version}}
2626

2727
archives:
2828
- id: versioned

cmd/root.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package cmd
22

33
import (
4-
"fmt"
54
"os"
65

76
"github.com/spf13/cobra"
@@ -55,7 +54,5 @@ func initConfig() {
5554
viper.BindEnv("api-key", "HUBSPOT_API_KEY")
5655

5756
// If a config file is found, read it in.
58-
if err := viper.ReadInConfig(); err == nil {
59-
fmt.Fprintln(os.Stderr, "Using config file:", viper.ConfigFileUsed())
60-
}
57+
viper.ReadInConfig()
6158
}

cmd/version.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,13 @@ package cmd
22

33
import (
44
"fmt"
5-
"runtime"
65

76
"github.com/spf13/cobra"
87
)
98

109
var (
11-
// These will be set by the build process using ldflags
12-
version = "dev"
13-
commit = "unknown"
14-
buildDate = "unknown"
10+
// This will be set by the build process using ldflags
11+
version = "dev"
1512
)
1613

1714
// versionCmd represents the version command
@@ -21,10 +18,6 @@ var versionCmd = &cobra.Command{
2118
Long: `Print the version number and build information of hscli.`,
2219
Run: func(cmd *cobra.Command, args []string) {
2320
fmt.Printf("hscli version %s\n", version)
24-
fmt.Printf("Commit: %s\n", commit)
25-
fmt.Printf("Build Date: %s\n", buildDate)
26-
fmt.Printf("Go Version: %s\n", runtime.Version())
27-
fmt.Printf("Platform: %s/%s\n", runtime.GOOS, runtime.GOARCH)
2821
},
2922
}
3023

0 commit comments

Comments
 (0)