Remove shell build script and replaced it with a Makefile.
This commit is contained in:
21
Makefile
Normal file
21
Makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
# Makefile for building testver
|
||||
|
||||
# Get version from git tags
|
||||
VERSION := $(shell git describe --tags --always 2>/dev/null)
|
||||
|
||||
# Default target
|
||||
.PHONY: testver clean
|
||||
|
||||
testver:
|
||||
ifneq ($(VERSION),)
|
||||
@echo "Building version: $(VERSION)"
|
||||
go build -o testver -ldflags "-X main.Version=$(VERSION)"
|
||||
else
|
||||
@echo "Building without version information"
|
||||
go build -o testver .
|
||||
endif
|
||||
|
||||
clean:
|
||||
rm -f testver
|
||||
|
||||
.DEFAULT_GOAL := testver
|
||||
11
build.sh
11
build.sh
@@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
VERSION=$(git describe --tags --always 2>/dev/null)
|
||||
|
||||
if [ ! -z "$VERSION" ]; then
|
||||
echo "Building version: $VERSION"
|
||||
go build -o test-version -ldflags "-X main.Version=$VERSION"
|
||||
else
|
||||
echo "Building without version information"
|
||||
go build -o test-version .
|
||||
fi
|
||||
Reference in New Issue
Block a user