Skip to content

Commit

Permalink
feature: use recent tag as version info
Browse files Browse the repository at this point in the history
  • Loading branch information
mfigurski80 committed Aug 29, 2023
1 parent c2884bd commit c7e6b9e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .build/get_version.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
git log --format="%H" -n 1 > .build/version.txt
git describe --tags > .build/version.txt
1 change: 0 additions & 1 deletion .build/version.txt
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
ERR: ERR: THIS BINARY IS NOT AN OFFICIAL DISTRIBUTION AND WILL NOT HAVE GENERATED CODE, INCLUDING VERSION INFORMATION
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ var AccessArgument = query.QueryAccessArgument{
var Version string

func main() {
if Version == "" {
fmt.Println("warning: version information is not set. Please run `go generate` while building to set version")
}

// parse access
origArgs := make([]string, len(os.Args))
copy(origArgs, os.Args)
Expand All @@ -48,7 +52,7 @@ func main() {
// parse user command
switch os.Args[1] {
case "v", "version":
fmt.Println("nt version:", Version)
fmt.Printf("nt version: %s", Version)
case "p", "peek":
requireAccess(AccessArgument)
peekArguments.Parse(os.Args[2:])
Expand Down

0 comments on commit c7e6b9e

Please sign in to comment.