File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,9 +8,20 @@ import (
88 "time"
99
1010 "github.com/urfave/cli/v2"
11+ "golang.org/x/mod/semver"
1112)
1213
1314const (
15+ // MinSupportedVersion is the minimum tcld version supported by our APIs.
16+ // This string must be updated when we deprecate older versions, but should be
17+ // done carefully as this will likely break user's current usage of tcld.
18+ MinSupportedVersion = "v0.1.3"
19+
20+ // DefaultVersionString is the version which is sent over if no version was available.
21+ // This can happen if a user builds the latest main branch, as the version string provided
22+ // to us from Go tooling is `(devel)`
23+ DefaultVersionString = MinSupportedVersion + "-no-version-available"
24+
1425 pseudoVersionMinLen = len ("vX.0.0-yyyymmddhhmmss-abcdefabcdef" )
1526 pseudoVersionCommitInfoLen = len ("yyyymmddhhmmss-abcdefabcdef" )
1627)
@@ -62,6 +73,10 @@ func NewBuildInfo() BuildInfo {
6273 info := BuildInfo {
6374 Version : di .Main .Version ,
6475 }
76+ if ! semver .IsValid (di .Main .Version ) {
77+ info .Version = DefaultVersionString
78+ }
79+
6580 if len (di .Main .Version ) >= pseudoVersionMinLen {
6681 // Used when compiled with `go install`.
6782 // See https://go.dev/ref/mod#pseudo-versions for more info on the expected string format
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ require (
1313 github.com/urfave/cli/v2 v2.25.3
1414 go.uber.org/fx v1.19.2
1515 go.uber.org/multierr v1.6.0
16- golang.org/x/mod v0.8 .0
16+ golang.org/x/mod v0.12 .0
1717 google.golang.org/grpc v1.54.0
1818)
1919
Original file line number Diff line number Diff line change @@ -69,6 +69,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
6969golang.org/x/mod v0.4.2 /go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA =
7070golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8 =
7171golang.org/x/mod v0.8.0 /go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs =
72+ golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc =
73+ golang.org/x/mod v0.12.0 /go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs =
7274golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 /go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg =
7375golang.org/x/net v0.0.0-20190620200207-3b0461eec859 /go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s =
7476golang.org/x/net v0.0.0-20200226121028-0de0cce0169b /go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s =
You can’t perform that action at this time.
0 commit comments