Skip to content
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

CLI not using project version #46

Closed
revett opened this issue Sep 10, 2018 · 0 comments
Closed

CLI not using project version #46

revett opened this issue Sep 10, 2018 · 0 comments
Labels
Task New task

Comments

@revett
Copy link
Contributor

revett commented Sep 10, 2018

Problem

The CLI is not using the project's version from the VERSION file in the root of the directory.

See: https://github.com/CityOfZion/neo-local/blob/master/VERSION

It instead has to manually set it's version within the main.go, see:

neo-local/cli/main.go

Lines 13 to 47 in 046c115

const (
copyright = "MIT"
description = "Quickly setup a local environment for NEO smart contract development"
version = "0.2.0"
)
var (
author = cli.Author{
Name: "City of Zion - https://github.com/cityofzion",
}
name = color.GreenString("neo-local")
)
func main() {
logWriter := logger.NewWriter(name, version)
log.SetFlags(0)
log.SetOutput(logWriter)
app := cli.NewApp()
app.Authors = []cli.Author{author}
app.Commands = commands.GenerateCommandsIndex()
app.Copyright = copyright
app.Name = name
app.Usage = description
app.Version = version
err := app.Run(os.Args)
if err != nil {
log.Fatalf(
"%s %s. Please check the FAQ: https://github.com/CityOfZion/neo-local/wiki/FAQ",
color.RedString("ERROR:"),
color.RedString(err.Error()),
)
}
}

This is annoying as you tend to forget to bump both, and the CI build on checks against one of them.

Solution

Pass the value of VERSION through when building the CLI.

See this gist for documentation on how to achieve this: https://gist.github.com/marz619/e91796afa5a951c0aa4595d7e73d78d0

@revett revett added the Task New task label Sep 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Task New task
Projects
None yet
Development

No branches or pull requests

1 participant