Skip to content

Commit

Permalink
use git version
Browse files Browse the repository at this point in the history
  • Loading branch information
raspi committed Jul 27, 2018
1 parent 910955a commit fbe5635
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
build:
go build -v -o duplikaatti
LAST_TAG := $(shell git describe --abbrev=0 --always --tags)

BINARY := duplikaatti
BUILDDIR := build

LDFLAGS := -ldflags "-s -w -X=main.VERSION=$(LAST_TAG)"

bin:
GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -v -o $(BUILDDIR)/$(BINARY)

bin-windows:
GOOS=windows GOARCH=amd64 go build $(LDFLAGS) -v -o $(BUILDDIR)/$(BINARY).exe

.PHONY: all clean test
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import (
"fmt"
)

var VERSION = `0.0.0`
var BUILD = `dev`

const (
VERSION = `2.0.0`
AUTHOR = `Pekka Järvinen`
YEAR = 2018
HOMEPAGE = `https://github.com/raspi/duplikaatti`
Expand Down Expand Up @@ -52,7 +54,7 @@ func main() {
flag.Usage = func() {
f := filepath.Base(os.Args[0])

fmt.Fprintf(flag.CommandLine.Output(), "Duplicate file remover (version %v)\n", VERSION)
fmt.Fprintf(flag.CommandLine.Output(), "Duplicate file remover (version %v build %v)\n", VERSION, BUILD)
fmt.Fprintf(flag.CommandLine.Output(), "Removes duplicate files. Algorithm idea from rdfind.\n")
fmt.Fprintf(flag.CommandLine.Output(), "\n")

Expand Down

0 comments on commit fbe5635

Please sign in to comment.