Skip to content

Commit

Permalink
💩
Browse files Browse the repository at this point in the history
  • Loading branch information
naiba committed Jan 18, 2022
1 parent 53bdb8c commit 165411a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ before:
builds:
- env:
- CGO_ENABLED=0
ldflags:
- -s -w -X main.version={{.Version}} -X main.arch={{.Arch}}
goos:
- linux
- windows
Expand Down
6 changes: 6 additions & 0 deletions cmd/agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"net/http"
"os"
"os/exec"
"runtime"
"time"

"github.com/blang/semver"
Expand Down Expand Up @@ -45,6 +46,7 @@ type AgentConfig struct {

var (
version string
arch string = runtime.GOARCH
client pb.NezhaServiceClient
inited bool
)
Expand All @@ -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

Expand Down

0 comments on commit 165411a

Please sign in to comment.