💩
This commit is contained in:
parent
53bdb8c6e4
commit
165411a12b
@ -4,6 +4,8 @@ before:
|
|||||||
builds:
|
builds:
|
||||||
- env:
|
- env:
|
||||||
- CGO_ENABLED=0
|
- CGO_ENABLED=0
|
||||||
|
ldflags:
|
||||||
|
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}}
|
||||||
goos:
|
goos:
|
||||||
- linux
|
- linux
|
||||||
- windows
|
- windows
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/blang/semver"
|
"github.com/blang/semver"
|
||||||
@ -45,6 +46,7 @@ type AgentConfig struct {
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
version string
|
version string
|
||||||
|
arch string = runtime.GOARCH
|
||||||
client pb.NezhaServiceClient
|
client pb.NezhaServiceClient
|
||||||
inited bool
|
inited bool
|
||||||
)
|
)
|
||||||
@ -71,6 +73,10 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
if arch != runtime.GOARCH {
|
||||||
|
panic(fmt.Sprintf("与当前系统不匹配,当前运行 %s_%s, 需要下载 %s_%s", runtime.GOOS, arch, runtime.GOOS, runtime.GOARCH))
|
||||||
|
}
|
||||||
|
|
||||||
// 来自于 GoReleaser 的版本号
|
// 来自于 GoReleaser 的版本号
|
||||||
monitor.Version = version
|
monitor.Version = version
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user