Simplifies the version command and Makefile by removing manual ldflags injection. The application now relies entirely on Go's built-in VCS metadata embedding to extract version, commit, and date information, ensuring accurate reporting across all build methods.
28 lines
537 B
Makefile
28 lines
537 B
Makefile
.PHONY: build install test coverage clean
|
|
|
|
# Build the binary (Go automatically embeds VCS info)
|
|
build:
|
|
@echo "Building gitlocal..."
|
|
go build -o gitlocal .
|
|
|
|
# Install to $GOPATH/bin
|
|
install:
|
|
@echo "Installing gitlocal..."
|
|
go install .
|
|
|
|
# Run tests
|
|
test:
|
|
@echo "Running tests..."
|
|
go test -v ./...
|
|
|
|
# Run tests with coverage
|
|
coverage:
|
|
@echo "Running tests with coverage..."
|
|
go test -coverprofile=coverage.out ./...
|
|
go tool cover -func=coverage.out
|
|
|
|
# Clean build artifacts
|
|
clean:
|
|
@echo "Cleaning..."
|
|
rm -f gitlocal coverage.out
|