-
Notifications
You must be signed in to change notification settings - Fork 19
/
version.go
43 lines (35 loc) · 823 Bytes
/
version.go
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package go_librespot
import (
"fmt"
"runtime"
"strings"
)
var commit, version string
func VersionNumberString() string {
if len(version) > 0 {
return strings.TrimPrefix(version, "v")
} else if len(commit) >= 8 {
return commit[:8]
} else {
return "dev"
}
}
func SpotifyLikeClientVersion() string {
if len(version) > 0 {
if len(commit) >= 8 {
return fmt.Sprintf("%s.g%s", version, commit[:8])
} else {
return version
}
}
return "0.0.0"
}
func VersionString() string {
return fmt.Sprintf("go-librespot %s", VersionNumberString())
}
func SystemInfoString() string {
return fmt.Sprintf("%s; Go %s (%s %s)", VersionString(), runtime.Version(), runtime.GOOS, runtime.GOARCH)
}
func UserAgent() string {
return fmt.Sprintf("go-librespot/%s Go/%s", VersionNumberString(), runtime.Version())
}