version

package
v1.11.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package version is used to expose the current version information as populated by the build process. With a default value of "unreleased" the `BuildMetadata` indicates that `Version` will likely be used as _next_ Git tag. During a build some or all of the variables my be overridden using the Go linker.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version is a "v" prefixed Semver, including pre-release information if applicable
	Version = defaultVersion
	// BuildMetadata is the Semver build metadata stored independent of the version string
	BuildMetadata = ""
	// GitCommit is a Git commit identifier
	GitCommit = ""
)

Functions

func UserAgent

func UserAgent(product, comment string, transport http.RoundTripper) http.RoundTripper

UserAgent wraps the (possibly nil) transport so that it will set the user agent using the supplied product name and current version

Types

type Info

type Info struct {
	Version       string `json:"version"`
	BuildMetadata string `json:"build"`
	GitCommit     string `json:"gitCommit"`
}

Info represents available version information

func GetInfo

func GetInfo() *Info

GetInfo returns the full version information

func (*Info) String

func (i *Info) String() string

String returns the full Semver of the version information

type Transport

type Transport struct {
	// UserAgent string to use, defaults to "RedSky/{version}" if unset
	UserAgent string
	// Base transport to use, uses the system default if nil
	Base http.RoundTripper
}

Transport sets the `User-Agent` header

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip sets the incoming request header and delegates to the base transport

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL