From 5bf65c580d9fc9102c644c6432bf4ada41b5b512 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Thu, 3 Jun 2021 11:19:29 -0700 Subject: [PATCH] version: fix Short when link-stamped And remove old SHORT, LONG deprecated variables. Fixes tailscale/corp#1905 Signed-off-by: Brad Fitzpatrick --- version/version.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/version/version.go b/version/version.go index 307375c13..6aaae3a83 100644 --- a/version/version.go +++ b/version/version.go @@ -12,13 +12,14 @@ var Long = "date.20210505" // Short is a short version number for this build, of the form // "x.y.z", or "date.yyyymmdd" if no actual version was provided. -var Short = Long +var Short = "" -// LONG is a deprecated alias for Long. Don't use it. -var LONG = Long - -// SHORT is a deprecated alias for Short. Don't use it. -var SHORT = Short +func init() { + if Short == "" { + // If it hasn't been link-stamped with -X: + Short = Long + } +} // GitCommit, if non-empty, is the git commit of the // github.com/tailscale/tailscale repository at which Tailscale was