Skip to content

Commit

Permalink
even more robust install
Browse files Browse the repository at this point in the history
  • Loading branch information
the-gigi committed Jul 8, 2020
1 parent eea0e94 commit 346e5fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ help:

## Build multi-git and inject the git tag and build time to variables in main
build:
go build -ldflags "-X 'main.gitTag=$$(git describe --tags)' -X 'main.buildTimestamp=$$(date -u)'" -o multi-git_$$(go env GOOS)_$$(go env GOARCH)
go build -ldflags "-X 'main.gitTag=$$(git describe --tags)' \
-X 'main.buildTimestamp=$$(date -u)'" \
-o multi-git_$$(go env GOOS)_$$(go env GOARCH)

## Install multi-git into /usr/local/bin (avoid standard go install)
install: build
mv multi-git_$$(go env GOOS)_$$(go env GOARCH) /usr/local/bin/multi-git_$$(go env GOOS)_$$(go env GOARCH)
mv multi-git_$$(go env GOOS)_$$(go env GOARCH) \
/usr/local/bin/multi-git_$$(go env GOOS)_$$(go env GOARCH)
rm /usr/local/bin/multi-git
ln -s /usr/local/bin/multi-git_$$(go env GOOS)_$$(go env GOARCH) /usr/local/bin/multi-git
ln -s /usr/local/bin/multi-git_$$(go env GOOS)_$$(go env GOARCH) \
/usr/local/bin/multi-git

## Run only the unit tests
unit-tests: build
Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/the-gigi/multi-git/cmd"
)

const (
var (
version = "v0.9.4"
)

Expand All @@ -21,6 +21,7 @@ var (

func main() {
if gitTag != "" {
version = gitTag
fmt.Println("Git tag:", gitTag)
}

Expand Down

0 comments on commit 346e5fd

Please sign in to comment.