Skip to content
This repository has been archived by the owner on Aug 19, 2020. It is now read-only.

Commit

Permalink
Added SemVer versioning to project
Browse files Browse the repository at this point in the history
  • Loading branch information
martinplaner committed Mar 10, 2017
1 parent ec9d367 commit 53c4a12
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 10 deletions.
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# git diff-index --quiet HEAD -- // returns 1 if UNclean
# you can also use "go generate" to trigger a script that fills in a "version.go" file ???
# check for set SYSTEMROOT envvar --> windows

LD_FLAGS = -s -w -H windowsgui
LD_FLAGS = -H windowsgui
LD_FLAGS_RELEASE = -s -w

build:
go build -ldflags="$(LD_FLAGS)"

# Needs: go get github.com/ahmetb/govvv
release:
govvv build -ldflags="$(LD_FLAGS) $(LD_FLAGS_RELEASE)"

# Needs: go get github.com/akavel/rsrc
resources:
rsrc -manifest gunarchiver.manifest -ico gunarchiver.ico -o rsrc.syso

clean:
rm gunarchiver.exe
rm rsrc.syso

dist:
zip gunarchiver.zip gunarchiver.exe README.md LICENSE
dist: release
zip gunarchiver-bin.zip gunarchiver.exe README.md LICENSE VERSION

test:
go test ./...
4 changes: 4 additions & 0 deletions archive/archive_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright 2017 Martin Planer. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package archive_test

// Tests for archive extraction.
Expand Down
3 changes: 1 addition & 2 deletions archive/tar/tar.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ import (
"os"
"strings"

"compress/gzip"

"archive/tar"
"compress/gzip"

"github.com/martinplaner/gunarchiver/archive"
)
Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ func main() {
var extractErr error
var uiErr error

PrintVersion()

if len(os.Args) != 2 {
fmt.Printf("Usage: %s <archive>\n", os.Args[0])
return
Expand Down
19 changes: 19 additions & 0 deletions version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package main

import (
"fmt"
"os"
)

var (
Version string = "undefined"
BuildDate string = "N/A"
GitCommit string = "undefined"
GitBranch string = ""
GitState string = ""
GitSummary string = ""
)

func PrintVersion() {
fmt.Printf("%s version %s\nbuild %s\ndate %s\n\n", os.Args[0], Version, GitCommit, BuildDate)
}

0 comments on commit 53c4a12

Please sign in to comment.