Skip to content

Conversation

deadprogram
Copy link
Member

This PR adds a tinygo version subcommand to display the current version of the TinyGo compiler:

tinygo version
TinyGo compiler v0.1.0

The same info is displayed alongside the usage info.

…n. Also displayed when usage is displayed

Signed-off-by: Ron Evans <ron@hybridgroup.com>
Copy link
Member

@aykevl aykevl left a 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()
Copy link
Member

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())
Copy link
Member

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"
Copy link
Member

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.

Copy link
Member Author

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>
@deadprogram
Copy link
Member Author

Updates pushed.

…mand does

Signed-off-by: Ron Evans <ron@hybridgroup.com>
Copy link
Member

@aykevl aykevl left a 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.

@deadprogram
Copy link
Member Author

OK, cool. Merging into dev.

@deadprogram deadprogram merged commit 403fee7 into dev Feb 8, 2019
@deadprogram deadprogram deleted the feature/add-version-subcommand branch February 8, 2019 10:22
deadprogram added a commit that referenced this pull request Feb 19, 2019
* cmd: add tinygo version subcommand to display current software version. Also displayed when usage is displayed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants