feat: log version
This commit is contained in:
parent
d1708d550e
commit
147b8a47df
@ -20,7 +20,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var version = "unstable"
|
||||
var Version = "unstable"
|
||||
|
||||
var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
@ -31,13 +31,13 @@ goc version
|
||||
`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
// if it is "Unstable", means user build local or with go get
|
||||
if version == "unstable" {
|
||||
if Version == "unstable" {
|
||||
if info, ok := debug.ReadBuildInfo(); ok {
|
||||
fmt.Println(info.Main.Version)
|
||||
}
|
||||
} else {
|
||||
// otherwise the value is injected in CI
|
||||
fmt.Println(version)
|
||||
fmt.Println(Version)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ RELEASE_VERSION=$(echo $EVENT_DATA | jq -r .release.tag_name)
|
||||
PROJECT_NAME=$(basename $GITHUB_REPOSITORY)
|
||||
NAME="${NAME:-${PROJECT_NAME}-${RELEASE_VERSION}}-${GOOS}-${GOARCH}"
|
||||
|
||||
CGO_ENABLED=0 go build -ldflags "-X 'github.com/RickLeee/goc-v2/cmd.version=${RELEASE_VERSION}'" .
|
||||
CGO_ENABLED=0 go build -ldflags "-X 'github.com/RickLeee/goc-v2/cmd.Version=${RELEASE_VERSION}'" .
|
||||
|
||||
ARCHIVE=tmp.tar.gz
|
||||
FILE_LIST=goc
|
||||
|
@ -17,6 +17,7 @@ import (
|
||||
"crypto/sha256"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/qiniu/goc/v2/cmd"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"net/rpc"
|
||||
@ -89,7 +90,7 @@ func (agent *gocCoveredAgent) closeConnection() {
|
||||
}
|
||||
}
|
||||
|
||||
// api 客户端,不是 agent
|
||||
// api 客户端,不是 agent
|
||||
type gocWatchClient struct {
|
||||
ws *websocket.Conn
|
||||
exitCh chan int
|
||||
@ -130,7 +131,7 @@ func RunGocServerUntilExit(host string, s store.Store) error {
|
||||
}
|
||||
|
||||
go gs.watchLoop()
|
||||
|
||||
log.Infof("version: %v", cmd.Version)
|
||||
return r.Run(host)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user