File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -22,3 +22,5 @@ _testmain.go
2222* .exe
2323* .test
2424* .prof
25+
26+ dist /
Original file line number Diff line number Diff line change 1+ VERSION := v0.1.0
2+ BUILDSTRING := $(shell git log --pretty=format:'% h' -n 1)
3+ VERSIONSTRING := tlsh version $(VERSION ) +$(BUILDSTRING )
4+ BUILDDATE := $(shell date -u -Iseconds)
5+
6+ clean :
7+ rm -rf dist/
8+
9+ LDFLAGS := "-X \"main.VERSION=$(VERSIONSTRING ) \" -X \"main.BUILDDATE=$(BUILDDATE ) \""
10+
11+ .PHONY : build_release
12+ build_release : clean
13+ cd app; gox -arch=" amd64" -os=" windows darwin linux" -output=" ../dist/tlsh-{{.Arch}}-{{.OS}}" -ldflags=$(LDFLAGS )
Original file line number Diff line number Diff line change @@ -8,10 +8,22 @@ import (
88 "github.com/glaslos/tlsh"
99)
1010
11+ var (
12+ // VERSION is set by the makefile
13+ VERSION = "v0.0.0"
14+ // BUILDDATE is set by the makefile
15+ BUILDDATE = ""
16+ )
17+
1118func main () {
1219 var file = flag .String ("f" , "" , "path to the file to be hashed" )
1320 var raw = flag .Bool ("r" , false , "set to get only the hash" )
21+ var version = flag .Bool ("version" , false , "print version" )
1422 flag .Parse ()
23+ if * version {
24+ fmt .Printf ("%s %s\n " , VERSION , BUILDDATE )
25+ return
26+ }
1527 if * file == "" {
1628 fmt .Fprintf (os .Stderr , "Usage of %s [-f <file>]\n \n " , os .Args [0 ])
1729 flag .PrintDefaults ()
You can’t perform that action at this time.
0 commit comments