mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-15 19:28:00 +01:00
Don't embed git commit sha in version command output
This commit is contained in:
7
Makefile
7
Makefile
@@ -1,6 +1,5 @@
|
||||
NAME=asciinema
|
||||
VERSION=$(shell grep 'const Version' main.go | awk -F '"' '{print $$2}')
|
||||
COMMIT=$(shell git rev-parse --short HEAD)
|
||||
|
||||
DIRS=bin
|
||||
INSTALL_DIRS=`find $(DIRS) -type d 2>/dev/null`
|
||||
@@ -15,7 +14,7 @@ DOC_DIR=$(PREFIX)/share/doc/$(NAME)
|
||||
all: build
|
||||
|
||||
build: test
|
||||
go build -o bin/asciinema -ldflags "-X main.GitCommit $(COMMIT)"
|
||||
go build -o bin/asciinema
|
||||
|
||||
test:
|
||||
go test ./...
|
||||
@@ -29,7 +28,7 @@ fmtdiff:
|
||||
travis: build fmtdiff
|
||||
|
||||
gox:
|
||||
gox -os="darwin freebsd linux" -arch="386 amd64" -output="bin/asciinema_{{.OS}}_{{.Arch}}" -ldflags "-X main.GitCommit $(COMMIT)"
|
||||
gox -os="darwin freebsd linux" -arch="386 amd64" -output="bin/asciinema_{{.OS}}_{{.Arch}}"
|
||||
|
||||
tag:
|
||||
git tag | grep "v$(VERSION)" && echo "Tag v$(VERSION) exists" && exit 1 || true
|
||||
@@ -65,6 +64,6 @@ RELEASE=asciinema-$(VERSION)-$(GOOS)-$(GOARCH)
|
||||
|
||||
os-arch-tgz:
|
||||
mkdir -p dist/$(VERSION)/$(RELEASE)
|
||||
go build -o dist/$(VERSION)/$(RELEASE)/asciinema -ldflags "-X main.GitCommit $(COMMIT)"
|
||||
go build -o dist/$(VERSION)/$(RELEASE)/asciinema
|
||||
cp README.md CHANGELOG.md LICENSE dist/$(VERSION)/$(RELEASE)
|
||||
cd dist/$(VERSION) && tar czf $(RELEASE).tar.gz $(RELEASE)
|
||||
|
||||
10
main.go
10
main.go
@@ -14,8 +14,6 @@ import (
|
||||
|
||||
const Version = "1.1.1"
|
||||
|
||||
var GitCommit string // initialized during build
|
||||
|
||||
var usage = `Record and share your terminal sessions, the right way.
|
||||
|
||||
Usage:
|
||||
@@ -79,13 +77,7 @@ func uintArg(args map[string]interface{}, name string, defaultValue uint) uint {
|
||||
}
|
||||
|
||||
func formatVersion() string {
|
||||
var commitInfo string
|
||||
|
||||
if GitCommit != "" {
|
||||
commitInfo = "-" + GitCommit
|
||||
}
|
||||
|
||||
return fmt.Sprintf("asciinema %v%v\n", Version, commitInfo)
|
||||
return fmt.Sprintf("asciinema %v", Version)
|
||||
}
|
||||
|
||||
func environment() map[string]string {
|
||||
|
||||
Reference in New Issue
Block a user