Skip to content

Commit

Permalink
remove branch ldflag
Browse files Browse the repository at this point in the history
  • Loading branch information
labkode committed Oct 24, 2019
1 parent 102b210 commit 914e985
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ release-deps:

# create local build versions
dist: default
go run tools/create-artifacts/main.go -version ${VERSION} -commit ${GIT_COMMIT} -branch ${GIT_BRANCH} -goversion ${GO_VERSION}
go run tools/create-artifacts/main.go -version ${VERSION} -commit ${GIT_COMMIT} -goversion ${GO_VERSION}

all: deps default
5 changes: 2 additions & 3 deletions cmd/revad/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var (
pidFlag = flag.String("p", "", "pid file. If empty defaults to a random file in the OS temporary directory")

// Compile time variables initialez with gcc flags.
gitCommit, gitBranch, buildDate, version, goVersion string
gitCommit, buildDate, version, goVersion string
)

type coreConf struct {
Expand Down Expand Up @@ -190,11 +190,10 @@ func getWriter(out string) (io.Writer, error) {
func getVersionString() string {
msg := "version=%s "
msg += "commit=%s "
msg += "branch=%s "
msg += "go_version=%s "
msg += "build_date=%s"

return fmt.Sprintf(msg, version, gitCommit, gitBranch, goVersion, buildDate)
return fmt.Sprintf(msg, version, gitCommit, goVersion, buildDate)
}

func handleVersionFlag() {
Expand Down
6 changes: 2 additions & 4 deletions tools/create-artifacts/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (

var (
commit = flag.String("commit", "", "sets git commit")
branch = flag.String("branch", "", "sets git branch")
version = flag.String("version", "", "sets git version")
goVersion = flag.String("goversion", "", "sets go version")
buildDate = time.Now().Format("2006-01-02")
Expand All @@ -47,7 +46,7 @@ var (
func init() {
flag.Parse()

if *commit == "" || *branch == "" || *version == "" || *goVersion == "" {
if *commit == "" || *version == "" || *goVersion == "" {
fmt.Fprint(os.Stderr, "fill all the flags\n")
os.Exit(1)
}
Expand All @@ -65,10 +64,9 @@ func main() {
os.Exit(1)
}

ldFlags := fmt.Sprintf("-s -X main.buildDate=%s -X main.gitCommit=%s -X main.gitBranch=%s -X main.version=%s -X main.goVersion=%s",
ldFlags := fmt.Sprintf("-s -X main.buildDate=%s -X main.gitCommit=%s -X main.version=%s -X main.goVersion=%s",
buildDate,
*commit,
*branch,
*version,
*goVersion,
)
Expand Down

0 comments on commit 914e985

Please sign in to comment.