-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't read tool version from a file.
Instead, rely on the version stored inside the compiled binary. This version is automatically filled by `go install`. This change will allow us to simply tag the release and not have to also update the version manually.
- Loading branch information
1 parent
5fe586c
commit 3e2dcde
Showing
5 changed files
with
62 additions
and
48 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
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
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
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,18 @@ | ||
package impl | ||
|
||
import ( | ||
"fmt" | ||
"runtime/debug" | ||
) | ||
|
||
// ToolVersion returns the version of the running tool binary, along with | ||
// an indication whether the tool was built manually, i.e., not via go install. | ||
func ToolVersion() (string, bool, error) { | ||
info, ok := debug.ReadBuildInfo() | ||
if !ok { | ||
// Should never happen. | ||
return "", false, fmt.Errorf("tool binary must be built from a module") | ||
} | ||
dev := info.Main.Version == "(devel)" | ||
return info.Main.Version, dev, nil | ||
} |
This file was deleted.
Oops, something went wrong.