Pull request: 2546 updater fix
Merge in DNS/adguard-home from 2546-updater-fix to master Closes #2546. Squashed commit of the following: commit af243c9fad710efe099506fda281e628c3e5ec30 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Jan 13 14:33:37 2021 +0300 updater: fix go 1.14 compat commit 742fba24b300ce51c04acb586996c3c75e56ea20 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Jan 13 13:58:27 2021 +0300 util: imp error check commit c2bdbce8af657a7f4b7e05c018cfacba86e06753 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Jan 11 18:51:26 2021 +0300 all: fix and refactor update checking
This commit is contained in:
53
internal/version/version.go
Normal file
53
internal/version/version.go
Normal file
@@ -0,0 +1,53 @@
|
||||
// Package version contains AdGuard Home version information.
|
||||
package version
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
// These are set by the linker. Unfortunately we cannot set constants during
|
||||
// linking, and Go doesn't have a concept of immutable variables, so to be
|
||||
// thorough we have to only export them through getters.
|
||||
//
|
||||
// TODO(a.garipov): Find out if we can get GOARM and GOMIPS values the same way
|
||||
// we can GOARCH and GOOS.
|
||||
var (
|
||||
channel string
|
||||
goarm string
|
||||
gomips string
|
||||
version string
|
||||
)
|
||||
|
||||
// Channel returns the current AdGuard Home release channel.
|
||||
func Channel() (v string) {
|
||||
return channel
|
||||
}
|
||||
|
||||
// Full returns the full current version of AdGuard Home.
|
||||
func Full() (v string) {
|
||||
msg := "AdGuard Home, version %s, channel %s, arch %s %s"
|
||||
if goarm != "" {
|
||||
msg = msg + " v" + goarm
|
||||
} else if gomips != "" {
|
||||
msg = msg + " " + gomips
|
||||
}
|
||||
|
||||
return fmt.Sprintf(msg, version, channel, runtime.GOOS, runtime.GOARCH)
|
||||
}
|
||||
|
||||
// GOARM returns the GOARM value used to build the current AdGuard Home release.
|
||||
func GOARM() (v string) {
|
||||
return goarm
|
||||
}
|
||||
|
||||
// GOMIPS returns the GOMIPS value used to build the current AdGuard Home
|
||||
// release.
|
||||
func GOMIPS() (v string) {
|
||||
return gomips
|
||||
}
|
||||
|
||||
// Version returns the AdGuard Home build version.
|
||||
func Version() (v string) {
|
||||
return version
|
||||
}
|
||||
Reference in New Issue
Block a user