Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // BucketCache enables and disables caching of the bucket's // response. This ensures that if check-go-version is run // multiple times by a build we're not hitting Google's // API for each invocation. BucketCache = true // BucketCacheTime is the amount of time to keep bucket information // cached. BucketCacheTime = time.Minute * 30 // BucketCacheFile is the location to cache bucket information. By default // this will be ~/.cache/check-go-version/bucket.json unless it's // overridden. BucketCacheFile = "" // BucketTimeout represents the amount of time we're willing to spend // retrieving information from the golang bucket. BucketTimeout = time.Minute * 5 )
var ( // RegexSemanticVersion extracts version information for a posted // release. This does not include the qualifier such as 'alpha', 'beta', // etc. RegexSemanticVersion = regexp.MustCompile(`^go(\d+\.\d+(\.\d+|)).+$`) // RegexFullVersion extracts the full version information. Unlike // RegexSemanticVersion this will include the qualifiers such as // 'alpha', 'beta', etc. RegexFullVersion = regexp.MustCompile(`^go(\d+\.\d+[a-z0-9]*(\.\d[a-z0-9]*|)).+$`) )
Functions ¶
func CheckLatest ¶
CheckLatest will return true if the latest version is the same as the currently running version.
func GetBucketObjects ¶
func GetBucketObjects() ([]*storage.ObjectAttrs, error)
GetBucketObjects queries the golang bucket in Google Object Store and returns the versions present as a list.
Types ¶
type Version ¶
type Version struct { // Name is the complete name of the version excluding the original // suffix (ex. go1.9.2rc2.windows-386 instead of go1.9.2rc2.windows-386.msi) Name string // Version is the version excluding qualifiers such as 'beta1'. For // example if FullVersion is 'go1.4rc2` then FullVersion is '1.4'. Version semver.Version // FullVersion contains the complete version information include the semantic // version. FullVersion string // Platform is the generic platform (ex. windows, darwin, linux) Platform string // Architecture is the architecture of the binary. (ex. amd64, 386) Architecture string }
Version returns specific information about a Go version.
func GetLatestRelease ¶
GetLatestRelease returns a *Version struct matching the latest release for the currently running platform.
func GetReleaseVersions ¶
GetReleaseVersions calls GetVersions and removes any version that is a 'non-release' version. Basically this returns all versions except those that are alpha/beta/etc. This does not provide any platform specific filtering.
func GetRunningVersion ¶
GetRunningVersion constructs and returns a *Version struct for the currently running instance of Go.
type Versions ¶
type Versions []*Version
Versions is a list of Version structs that have the added benefit of being sortable.
func FilterVersionsToPlatform ¶
FilterVersionsToPlatform acts as a filter and returns all versions that are matching the current platform.
func GetReleaseVersionsForPlatform ¶
GetReleaseVersionsForPlatform calls GetReleaseVersions() and filters the results so only releases matching the current platform are returned.
func GetVersions ¶
GetVersions returns a list of golang releases. This function will ignore any object returned from GetBucketObjects() that matches one or more of the following conditions:
- Name of object starts with getgo/ - Ignored because this tool assumes you already have go installed. These objects also don't contain any version information.
- Content type of objects starts with text/plain - Ignored because they are not actually releases (typically sha256 sums).
- Is a signature instead of a release.
- Appears to be a source rather than a release.