version
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package version provides the version that the binary was built at.
Index¶
- func AtLeast(version string, minimum string) bool
- func CmdName() string
- func IsAppleTV() bool
- func IsMacAppStore() bool
- func IsMacAppStoreGUI() bool
- func IsMacGUIVariant() bool
- func IsMacSys() bool
- func IsMacSysExt() bool
- func IsMacSysGUI() bool
- func IsMobile() bool
- func IsRace() bool
- func IsSandboxedMacOS() bool
- func IsUnstableBuild() bool
- func IsWindowsGUI() bool
- func Long() string
- func OS() string
- func Short() string
- func String() string
- type Meta
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
funcAtLeast¶added inv0.100.0
AtLeast returns whether version is at least the specified minimumversion.
Version comparison in Tailscale is a little complex, because weswitched "styles" a few times, and additionally have a completelyseparate track of version numbers for OSS-only builds.
AtLeast acts conservatively, returning true only if it's certainthat version is at least minimum. As a result, it can produce falsenegatives, for example when an OSS build supports a given feature,but AtLeast is called with an official release number as theminimum
version and minimum can both be either an official Tailscaleversion numbers (major.minor.patch-extracommits-extrastring), or anOSS build datestamp (date.YYYYMMDD). For Tailscale version numbers,AtLeast also accepts a prefix of a full version, in which case allmissing fields are assumed to be zero.
funcCmdName¶
func CmdName()string
CmdName returns either the base name of the current binaryusing os.Executable. If os.Executable fails (it shouldn't), then"cmd" is returned.
funcIsAppleTV¶added inv1.44.0
func IsAppleTV()bool
IsAppleTV reports whether this binary is part of the Tailscale network extension for tvOS.Needed because runtime.GOOS returns "ios" otherwise.
funcIsMacAppStore¶added inv1.52.0
func IsMacAppStore()bool
IsMacAppStore returns whether this binary is from the App Store version of Tailscalefor macOS. Returns true for both the network extension and the GUI app.
funcIsMacAppStoreGUI¶added inv1.82.0
func IsMacAppStoreGUI()bool
IsMacAppStoreGUI reports whether this binary is the GUI app from the App Storeversion of Tailscale for macOS.
funcIsMacGUIVariant¶added inv1.64.0
func IsMacGUIVariant()bool
IsMacGUIVariant reports whether runtime.GOOS=="darwin" and this one of thetwo GUI variants (that is, not tailscaled-on-macOS).This predicate should not be used to determine sandboxing properties. It'smeant for callers to determine whether the NetworkExtension-like auto-netnsis in effect.
funcIsMacSys¶added inv1.64.0
func IsMacSys()bool
IsMacSys reports whether this process is part of the Standalone variant ofTailscale for macOS, either the main GUI process (non-sandboxed) or thesystem extension (sandboxed).
funcIsMacSysExt¶added inv1.8.0
func IsMacSysExt()bool
IsMacSysExt reports whether this binary is the system extension shipped as part ofthe standalone "System Extension" (a.k.a. "macsys") version of Tailscalefor macOS.
funcIsMacSysGUI¶added inv1.82.0
func IsMacSysGUI()bool
IsMacSysGUI reports whether this process is the main, non-sandboxed GUI processthat ships with the Standalone variant of Tailscale for macOS.
funcIsRace¶added inv1.10.0
func IsRace()bool
IsRace reports whether the current binary was built with the Gorace detector enabled.
funcIsSandboxedMacOS¶added inv1.8.0
func IsSandboxedMacOS()bool
IsSandboxedMacOS reports whether this process is a sandboxed macOSprocess (either the app or the extension). It is true for the Mac App Storeand macsys (System Extension) version on macOS, and false fortailscaled-on-macOS.
funcIsUnstableBuild¶added inv1.34.0
func IsUnstableBuild()bool
IsUnstableBuild reports whether this is an unstable build.That is, whether its minor version number is odd.
funcIsWindowsGUI¶added inv1.20.0
func IsWindowsGUI()bool
IsWindowsGUI reports whether the current process is the Windows GUI.
funcLong¶added inv1.2.0
func Long()string
Long returns a full version number for this build, of one of the forms:
- "x.y.z-commithash-otherhash" for release builds distributed by Tailscale
- "x.y.z-commithash" for release builds built with build_dist.sh
- "x.y.z-changecount-commithash-otherhash" for untagged release branchbuilds by Tailscale (these are not distributed).
- "x.y.z-changecount-commithash" for untagged release branch buildsbuilt with build_dist.sh
- "x.y.z-devYYYYMMDD-commithash{,-dirty}" for builds made with plain "gobuild" or "go install"
- "x.y.z-ERR-BuildInfo" for builds made by plain "go run"
funcOS¶added inv0.98.0
func OS()string
OS returns runtime.GOOS, except instead of returning "darwin" it returns"iOS" or "macOS".
funcShort¶added inv1.2.0
func Short()string
Short returns a short version number for this build, of the forms:
- "x.y.z" for builds distributed by Tailscale or built with build_dist.sh
- "x.y.z-devYYYYMMDD" for builds made with plain "go build" or "go install"
- "x.y.z-ERR-BuildInfo" for builds made by plain "go run"
Types¶
typeMeta¶added inv1.36.0
type Meta struct {// MajorMinorPatch is the "major.minor.patch" version string, without// any hyphenated suffix.MajorMinorPatchstring `json:"majorMinorPatch"`// IsDev is whether Short contains a -dev suffix. This is whether the build// is a development build (as opposed to an official stable or unstable// build stamped in the usual ways). If you just run "go install" or "go// build" on a dev branch, this will be true.IsDevbool `json:"isDev,omitempty"`// Short is MajorMinorPatch but optionally adding "-dev" or "-devYYYYMMDD"// for dev builds, depending on how it was build.Shortstring `json:"short"`// Long is the full version string, including git commit hash(es) as the// suffix.Longstring `json:"long"`// UnstableBranch is whether the build is from an unstable (development)// branch. That is, it reports whether the minor version is odd.UnstableBranchbool `json:"unstableBranch,omitempty"`// GitCommit, if non-empty, is the git commit of the// github.com/tailscale/tailscale repository at which Tailscale was// built. Its format is the one returned by `git describe --always// --exclude "*" --dirty --abbrev=200`.GitCommitstring `json:"gitCommit,omitempty"`// GitDirty is whether Go stamped the binary as having dirty version// control changes in the working directory (debug.ReadBuildInfo// setting "vcs.modified" was true).GitDirtybool `json:"gitDirty,omitempty"`// ExtraGitCommit, if non-empty, is the git commit of a "supplemental"// repository at which Tailscale was built. Its format is the same as// gitCommit.//// ExtraGitCommit is used to track the source revision when the main// Tailscale repository is integrated into and built from another// repository (for example, Tailscale's proprietary code, or the// Android OSS repository). Together, GitCommit and ExtraGitCommit// exactly describe what repositories and commits were used in a// build.ExtraGitCommitstring `json:"extraGitCommit,omitempty"`// DaemonLong is the version number from the tailscaled// daemon, if requested.DaemonLongstring `json:"daemonLong,omitempty"`// GitCommitTime is the commit time of the git commit in GitCommit.GitCommitTimestring `json:"gitCommitTime,omitempty"`// Cap is the current Tailscale capability version. It's a monotonically// incrementing integer that's incremented whenever a new capability is// added.Capint `json:"cap"`}Meta is a JSON-serializable type that contains all the versioninformation.
Directories¶
| Path | Synopsis |
|---|---|
Package distro reports which distro we're running on. | Package distro reports which distro we're running on. |
Package mkversion gets version info from git and provides a bunch of differently formatted version strings that get used elsewhere in the build system to embed version numbers into binaries. | Package mkversion gets version info from git and provides a bunch of differently formatted version strings that get used elsewhere in the build system to embed version numbers into binaries. |