-
Notifications
You must be signed in to change notification settings - Fork 989
Add tinygo version subcommand #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…n. Also displayed when usage is displayed Signed-off-by: Ron Evans <ron@hybridgroup.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be much simpler:
// in version.go:
const version = "0.1" // or 0.1.0
// in the subcommand switch
case "version":
fmt.Printf("tinygo version %s %s/%s", version, runtime.GOOS(), runtime.GOARCH())
// in usage()
fmt.Fprintln(os.Stderr, "TinyGo is a Go compiler for small places.")
fmt.Fprintln(os.Stderr, "version:", version)
main.go
Outdated
usage() | ||
case "version": | ||
fmt.Fprintln(os.Stderr, displayversion()) | ||
version() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A call to version
that doesn't do anything?
main.go
Outdated
case "help": | ||
usage() | ||
case "version": | ||
fmt.Fprintln(os.Stderr, displayversion()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name displayversion
suggests to me that this function actually prints the version.
version.go
Outdated
|
||
// tinyGoVersion of this package. | ||
// Update this value before release of new version of software. | ||
const tinyGoVersion = "0.1.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current tag is v0.1
, not v0.1.0
. Go uses the former, semver uses the latter. I'm fine with both, but I think they should be aligned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we use x.y.z
format to make it explicit.
Signed-off-by: Ron Evans <ron@hybridgroup.com>
Updates pushed. |
…mand does Signed-off-by: Ron Evans <ron@hybridgroup.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
OK, cool. Merging into dev. |
* cmd: add tinygo version subcommand to display current software version. Also displayed when usage is displayed
This PR adds a
tinygo version
subcommand to display the current version of the TinyGo compiler:The same info is displayed alongside the usage info.