File: strings.go

package info (click to toggle)
pat 0.19.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,228 kB
  • sloc: javascript: 3,864; sh: 147; makefile: 11
file content (25 lines) | stat: -rw-r--r-- 765 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package buildinfo

import (
	"fmt"
	"runtime"
)

// VersionString returns a very descriptive version including the app SemVer, git rev plus the
// Golang OS, architecture and version.
func VersionString() string {
	return fmt.Sprintf("%s %s/%s - %s",
		VersionStringShort(), runtime.GOOS, runtime.GOARCH, runtime.Version())
}

// VersionStringShort returns the app SemVer and git rev.
func VersionStringShort() string {
	return fmt.Sprintf("v%s (%s)", Version, GitRev)
}

// UserAgent returns a suitable HTTP user agent string containing app name, SemVer, git rev, plus
// the Golang OS, architecture and version.
func UserAgent() string {
	return fmt.Sprintf("%v/%v (%v) %v (%v; %v)",
		AppName, Version, GitRev, runtime.Version(), runtime.GOOS, runtime.GOARCH)
}