Skip to content

Commit

Permalink
[dev] add build params
Browse files Browse the repository at this point in the history
  • Loading branch information
nanmu42 committed Sep 11, 2018
1 parent cebfa8a commit 768a72a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/issueToken/cross_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

VERSION=`git describe --tags --dirty`
BUILD=`date +%FT%T%z`

xgo \
--targets=windows/386,windows/amd64,darwin/386,darwin/amd64,linux/386,linux/amd64 \
-ldflags "-s -w -X github.com/dabankio/TokenIssuer/cmd/issueToken.Version=$VERSION -X github.com/dabankio/TokenIssuer/cmd/issueToken.BuildDate=$BUILD" \
./
7 changes: 7 additions & 0 deletions cmd/issueToken/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ var (
decimals uint64
owner string
prikeyStr string

// Version build params
Version string
// BuildDate build params
BuildDate string
)

func init() {
Expand All @@ -49,6 +54,8 @@ func init() {
func main() {
flag.Parse()

fmt.Printf("issueToken(%s) by Dabank Authors, built on %s\n", Version, BuildDate)

var err error
defer func() {
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions cmd/issueToken/native_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

VERSION=`git describe --tags --dirty`
BUILD=`date +%FT%T%z`

go build -ldflags "-s -w -X github.com/dabankio/TokenIssuer/cmd/issueToken.Version=$VERSION -X github.com/dabankio/TokenIssuer/cmd/issueToken.BuildDate=$BUILD"

0 comments on commit 768a72a

Please sign in to comment.