You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "ShyunnY (via GitHub)" <gi...@apache.org> on 2024/06/01 06:13:36 UTC
Re: [PR] feat: enhance version info [skywalking-go]
ShyunnY commented on code in PR #185:
URL: https://github.com/apache/skywalking-go/pull/185#discussion_r1623158245
##########
tools/go-agent/Makefile:
##########
@@ -23,12 +23,15 @@ BINARY = skywalking-go-agent
SH = sh
GO = go
GIT = git
+GIT_COMMIT := $(shell $(GIT) rev-parse --short HEAD)
+GO_VERSION := $(shell $(GO) version | sed 's/go version go\([0-9.]*\).*/\1/')
+VERSION_PACKAGE := main
PROTOC = protoc
GO_PATH = $$($(GO) env GOPATH)
GO_BUILD = $(GO) build
GO_LINT = $(GO_PATH)/bin/golangci-lint
GO_BUILD_FLAGS = -v
-GO_BUILD_LDFLAGS = -X main.version=$(VERSION)
+GO_BUILD_LDFLAGS = -X $(VERSION_PACKAGE).version=$(VERSION) -X $(VERSION_PACKAGE).goVersion=$(GO_VERSION) -X $(VERSION_PACKAGE).gitCommit=$(GIT_COMMIT)
Review Comment:
I insert the VERSION file when compiling src tgz, so that the information obtained by users directly downloading the source package is always consistent with the information obtained by git clone.
This presents the idea that "no matter how you install, the information is always consistent"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org