-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #44: Integrate the version information into the binary to support…
… 3rd party packaging
- Loading branch information
1 parent
bf4f9ef
commit 2d8ab1b
Showing
2 changed files
with
13 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
package main | ||
|
||
import ( | ||
_ "embed" | ||
"fmt" | ||
"github.com/sibprogrammer/xq/cmd" | ||
"strings" | ||
) | ||
|
||
var ( | ||
commit = "000000" | ||
date = "unknown" | ||
version = "0.0.0" | ||
commit = "000000" | ||
date = "" | ||
) | ||
|
||
//go:embed version | ||
var version string | ||
|
||
func main() { | ||
cmd.Version = fmt.Sprintf("%s (%s, %s)", version, date, commit) | ||
fullVersion := strings.TrimSpace(version) | ||
if date != "" { | ||
fullVersion += fmt.Sprintf(" (%s, %s)", date, commit) | ||
} | ||
cmd.Version = fullVersion | ||
cmd.Execute() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.2.2 |