Problem
staticcheck U1000 reports version, commit, date are unused at internal/cli/root.go:31-33.
SetVersion(v,c,d) assigns them and sets RootCmd.Version, but the vars themselves aren't referenced elsewhere.
Fix (recommended)
Remove the stored vars and use RootCmd.Version only:
- // Build info
- version string
- commit string
- date string
)
func SetVersion(v, c, d string) {
- version = v
- commit = c
- date = d
if RootCmd != nil {
RootCmd.Version = fmt.Sprintf("%s (commit: %s, built: %s)", v, c, d)
}
}
Alternative: if the vars are needed later, reference them somewhere (e.g., debug output). But removing them is simplest.
Problem
staticcheck U1000 reports
version,commit,dateare unused atinternal/cli/root.go:31-33.SetVersion(v,c,d)assigns them and setsRootCmd.Version, but the vars themselves aren't referenced elsewhere.Fix (recommended)
Remove the stored vars and use
RootCmd.Versiononly:Alternative: if the vars are needed later, reference them somewhere (e.g., debug output). But removing them is simplest.