Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e82aa12f27 |
No files matched your search
@@ -1041,9 +1041,8 @@ is `git describe --tags --always --dirty`, which `script/version` runs for the
|
||||
A `docker build .` of a clone, with no build arguments, runs the same
|
||||
`git describe` (without `--dirty`) on the `.git` in its build context, so it
|
||||
stamps the same value for a clean commit; the build fails if the context carries
|
||||
`.git` and no version, commit or commit date comes out. `make` outside a git
|
||||
checkout and `docker build .` without `.git` both stamp `dev`. `script/docker`
|
||||
and `script/cibuild` stamp `unknown` when they run outside a git checkout.
|
||||
`.git` and no version, commit or commit date comes out. `script/docker` and
|
||||
`script/cibuild` stamp `unknown` when they run outside a git checkout.
|
||||
|
||||
A binary built by plain `go install` or `go build` carries no stamped version.
|
||||
It reports the version Go recorded in it instead:
|
||||
@@ -1057,21 +1056,13 @@ It reports the version Go recorded in it instead:
|
||||
tag `v1.0.0` produces `vaultik 1.0.0`, matching the archive name
|
||||
`vaultik_1.0.0_linux_amd64.tar.gz`. `goreleaser --snapshot` stamps
|
||||
`dev-<12 chars of the commit sha>` rather than inventing the next patch number.
|
||||
|
||||
`vaultik version` calls a build a development build when its version is one of
|
||||
these:
|
||||
|
||||
- `dev` or `unknown`.
|
||||
- `dev-<sha>`.
|
||||
- the short commit sha.
|
||||
- `<tag>-<N>-g<short sha>`.
|
||||
- a Go pseudo-version.
|
||||
- any version with a `-dirty` or `+dirty` suffix.
|
||||
|
||||
Only a plain tag, such as `v1.0.0` or `1.0.0`, is a release. If `script/version`
|
||||
cannot be run at all, `make` stops with an error instead of building an
|
||||
unversioned binary, and a binary that somehow carries an empty version string
|
||||
still reports itself as a development build.
|
||||
`vaultik version` calls a build a development build when its version is `dev`,
|
||||
`unknown`, `dev-<sha>`, the short commit sha, `<tag>-<N>-g<short sha>` or a Go
|
||||
pseudo-version, with or without `-dirty` or `+dirty`; only a plain tag, such as
|
||||
`v1.0.0` or `1.0.0`, is a release. If `script/version` cannot be run at all,
|
||||
`make` stops with an error instead of building an unversioned binary, and a
|
||||
binary that somehow carries an empty version string still reports itself as a
|
||||
development build.
|
||||
|
||||
### cutting a release
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ const shortCommitLen = 12
|
||||
const exitCodeInterrupted = 130
|
||||
|
||||
// Entry is the main entry point for the CLI application.
|
||||
// It first calls globals.UseBuildInfo, which fills in the version,
|
||||
// commit and commit date that the linker flags did not set.
|
||||
// It first takes the version, commit and commit date the linker flags
|
||||
// left unset from the Go build info (see globals.FromBuildInfo).
|
||||
// It prints the startup banner to stderr (unless a banner-suppressing
|
||||
// flag is present in os.Args — see bannerSuppressedInArgs), executes the
|
||||
// root cobra command, and routes any returned error through the
|
||||
|
||||
@@ -53,13 +53,11 @@ func UseBuildInfo() {
|
||||
info, Version, Commit, CommitDate)
|
||||
}
|
||||
|
||||
// FromBuildInfo returns version, commit and commitDate. Each one that
|
||||
// still holds its default ("dev" or empty for the version, "unknown"
|
||||
// for the others) is replaced by the value Go recorded in info. A
|
||||
// `go install` of a tag sets no linker flags, but Go records the tag
|
||||
// as the main module's version. Go records the commit and its time
|
||||
// only when it builds from a git checkout. The time is cut to a date,
|
||||
// as the Makefile stamps it.
|
||||
// FromBuildInfo returns version, commit and commitDate, with each one
|
||||
// the linker flags left unset taken from info. A `go install` of a tag
|
||||
// sets no linker flags, but Go records the tag as the main module's
|
||||
// version. Go records the commit and its time only when it builds from
|
||||
// a git checkout. The time is cut to a date, as the Makefile stamps it.
|
||||
func FromBuildInfo(
|
||||
info *debug.BuildInfo, version, commit, commitDate string,
|
||||
) (string, string, string) {
|
||||
|
||||
Reference in new issue
Block a user