Skip to content

Commit

Permalink
Get version info from git
Browse files Browse the repository at this point in the history
Instead of manually setting version in Makefile, use $(git describe
--tags) which shows the most recent tag, number of revisions since that
tag, and short hash of current commit.

Can also get more version info form the binary with `go version gsheet`
  • Loading branch information
cristoper committed Jun 9, 2024
1 parent 062b874 commit ade3ae5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
version := v0.1.4
version := $(shell git describe --tags)
ldflags := '-s -w -X main.version=${version}'
platforms := linux_386 linux_amd64 darwin_amd64 windows_386 windows_amd64
SHELL := /bin/bash

.PHONY: build
build:
go build -o gsheet ./cmd/gsheet/
go build -ldflags ${ldflags} -o gsheet ./cmd/gsheet/

.PHONY: test
test:
Expand Down

0 comments on commit ade3ae5

Please sign in to comment.