This commit is contained in:
naiba 2022-01-18 20:41:51 +08:00
parent 53bdb8c6e4
commit 165411a12b
2 changed files with 8 additions and 0 deletions

View File

@ -4,6 +4,8 @@ before:
builds:
- env:
- CGO_ENABLED=0
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}}
goos:
- linux
- windows

View File

@ -11,6 +11,7 @@ import (
"net/http"
"os"
"os/exec"
"runtime"
"time"
"github.com/blang/semver"
@ -45,6 +46,7 @@ type AgentConfig struct {
var (
version string
arch string = runtime.GOARCH
client pb.NezhaServiceClient
inited bool
)
@ -71,6 +73,10 @@ func init() {
}
func main() {
if arch != runtime.GOARCH {
panic(fmt.Sprintf("与当前系统不匹配,当前运行 %s_%s, 需要下载 %s_%s", runtime.GOOS, arch, runtime.GOOS, runtime.GOARCH))
}
// 来自于 GoReleaser 的版本号
monitor.Version = version