aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorMax Resnick <max@ofmax.li>2024-01-02 22:18:46 -0800
committerMax Resnick <max@ofmax.li>2024-01-02 22:18:46 -0800
commit7d1319f8ac864d5f9b428521264fd0e2e0d8801a (patch)
tree6ac474427bb20703cb8a0dcbd0b43e30984e14fc /main.go
parentac8c0b6777a45b8ba42ac9378b01315df788d108 (diff)
downloadgo-bumpver-7d1319f8ac864d5f9b428521264fd0e2e0d8801a.tar.gz
chore: fix linting/vet issues
Diffstat (limited to 'main.go')
-rw-r--r--main.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/main.go b/main.go
index efbc4f1..38f131e 100644
--- a/main.go
+++ b/main.go
@@ -1,3 +1,4 @@
+// go bump ver tool
package main
import (
@@ -18,11 +19,14 @@ import (
"github.com/Masterminds/semver/v3"
)
+// FmtPart format keywords
type FmtPart string
var (
+ // BumpInt an int to be bumped
BumpInt FmtPart = "$BumpInt"
- KeyArg FmtPart = "$KeyArg"
+ // KeyArg an keyword argument to the format
+ KeyArg FmtPart = "$KeyArg"
)
type preReleaseVersion struct {
@@ -99,10 +103,8 @@ func (prf *preReleaseVersion) incPreRelease() (semver.Version, error) {
}
var (
- errNoRemoteFound = errors.New("No remotes found")
validArgs = []string{"major", "minor", "patch"}
- remoteName string
- preReleaseFmtArgs map[string]string = make(map[string]string)
+ preReleaseFmtArgs = make(map[string]string)
preRelease bool
rootCmd = &cobra.Command{
Use: "semverbump part [major|minor|patch] file [-|file]",
@@ -227,6 +229,7 @@ func init() {
rootCmd.PersistentFlags().String("prerelease-fmt", "PR.$KeyArg PR_NUM.$BumpInt", "The format string for prerelease versions")
rootCmd.PersistentFlags().StringToStringVarP(&preReleaseFmtArgs, "key-args", "k", nil, "key=arg for the fmt string")
rootCmd.PersistentFlags().String("repo-dir", cwd, "repo to examine")
- remoteName = *rootCmd.PersistentFlags().String("remote-name", "origin", "remote to search and push to")
- viper.BindPFlags(rootCmd.PersistentFlags())
+ if err := viper.BindPFlags(rootCmd.PersistentFlags()); err != nil {
+ log.Fatal(err)
+ }
}