Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default version set to minimum support version for tcld #246

Merged
merged 2 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions app/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,20 @@ import (
"time"

"github.com/urfave/cli/v2"
"golang.org/x/mod/semver"
)

const (
// MinSupportedVersion is the minimum tcld version supported by our APIs.
// This string must be updated when we deprecate older versions, but should be
// done carefully as this will likely break user's current usage of tcld.
MinSupportedVersion = "v0.1.3"

// DefaultVersionString is the version which is sent over if no version was available.
// This can happen if a user builds the latest main branch, as the version string provided
// to us from Go tooling is `(devel)`
DefaultVersionString = MinSupportedVersion + "-no-version-available"

pseudoVersionMinLen = len("vX.0.0-yyyymmddhhmmss-abcdefabcdef")
pseudoVersionCommitInfoLen = len("yyyymmddhhmmss-abcdefabcdef")
)
Expand Down Expand Up @@ -62,6 +73,10 @@ func NewBuildInfo() BuildInfo {
info := BuildInfo{
Version: di.Main.Version,
}
if !semver.IsValid(di.Main.Version) {
info.Version = DefaultVersionString
}

if len(di.Main.Version) >= pseudoVersionMinLen {
// Used when compiled with `go install`.
// See https://go.dev/ref/mod#pseudo-versions for more info on the expected string format
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/urfave/cli/v2 v2.25.3
go.uber.org/fx v1.19.2
go.uber.org/multierr v1.6.0
golang.org/x/mod v0.8.0
golang.org/x/mod v0.12.0
google.golang.org/grpc v1.54.0
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
Expand Down