version: unexport all vars, turn Short/Long into funcs

The other formerly exported values aren't used outside the package,
so just unexport them.

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson
2023-02-10 22:20:36 -08:00
committed by Dave Anderson
parent 9e6b4d7ad8
commit 8b2ae47c31
20 changed files with 67 additions and 59 deletions

View File

@@ -160,12 +160,12 @@ type updater struct {
}
func (up *updater) currentOrDryRun(ver string) bool {
if version.Short == ver {
if version.Short() == ver {
fmt.Printf("already running %v; no update needed\n", ver)
return true
}
if updateArgs.dryRun {
fmt.Printf("Current: %v, Latest: %v\n", version.Short, ver)
fmt.Printf("Current: %v, Latest: %v\n", version.Short(), ver)
return true
}
return false
@@ -173,11 +173,11 @@ func (up *updater) currentOrDryRun(ver string) bool {
func (up *updater) confirm(ver string) error {
if updateArgs.yes {
log.Printf("Updating Tailscale from %v to %v; --yes given, continuing without prompts.\n", version.Short, ver)
log.Printf("Updating Tailscale from %v to %v; --yes given, continuing without prompts.\n", version.Short(), ver)
return nil
}
fmt.Printf("This will update Tailscale from %v to %v. Continue? [y/n] ", version.Short, ver)
fmt.Printf("This will update Tailscale from %v to %v. Continue? [y/n] ", version.Short(), ver)
var resp string
fmt.Scanln(&resp)
resp = strings.ToLower(resp)
@@ -430,7 +430,7 @@ func installMSI(msi string) error {
if err == nil {
break
}
uninstallVersion := version.Short
uninstallVersion := version.Short()
if v := os.Getenv("TS_DEBUG_UNINSTALL_VERSION"); v != "" {
uninstallVersion = v
}

View File

@@ -267,7 +267,7 @@ func beWindowsSubprocess() bool {
// Remove the date/time prefix; the logtail + file loggers add it.
log.SetFlags(0)
log.Printf("Program starting: v%v: %#v", version.Long, os.Args)
log.Printf("Program starting: v%v: %#v", version.Long(), os.Args)
log.Printf("subproc mode: logid=%v", logid)
if err := envknob.ApplyDiskConfigError(); err != nil {
log.Printf("Error reading environment config: %v", err)

View File

@@ -54,7 +54,7 @@ func runBuildPkg() {
log.Fatalf("Cannot copy readme: %v", err)
}
log.Printf("Built package version %s", version.Long)
log.Printf("Built package version %s", version.Long())
}
func precompressWasm() error {
@@ -78,7 +78,7 @@ func updateVersion() error {
if err := json.Unmarshal(packageJSONBytes, &packageJSON); err != nil {
return fmt.Errorf("Could not unmarshal package.json: %w", err)
}
packageJSON["version"] = version.Long
packageJSON["version"] = version.Long()
packageJSONBytes, err = json.MarshalIndent(packageJSON, "", " ")
if err != nil {