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

Version requirements #357

Merged
merged 3 commits into from
Mar 25, 2021
Merged

Version requirements #357

merged 3 commits into from
Mar 25, 2021

Conversation

davidcheung
Copy link
Contributor

allow modules to declare versions of Zero it would work with
this allows us to introduce breaking change and let users know the modules require newest features of Zero

@davidcheung davidcheung requested a review from a team March 24, 2021 21:14
@davidcheung davidcheung self-assigned this Mar 24, 2021
@@ -1,7 +1,7 @@
VERSION = 0.0.1
BUILD ?=$(shell git rev-parse --short HEAD)
PKG ?=github.com/commitdev/zero
BUILD_ARGS=-v -trimpath -ldflags=all="-X ${PKG}/cmd.appVersion=${VERSION} -X ${PKG}/cmd.appBuild=${BUILD}"
BUILD_ARGS=-v -trimpath -ldflags=all="-X ${PKG}/version.AppVersion=${VERSION} -X ${PKG}/version.AppBuild=${BUILD}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For real releases this actually gets set by .goreleaser.yml, not the Makefile.

| `author` | string | Author of the module |
| `icon` | string | Path to logo image |
| `parameters` | list(Parameter) | Parameters to prompt users |
| `zeroVersion` | string(go-semver)| Zero versions its compatible with |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe include a link to the go-version readme?

@@ -107,6 +138,10 @@ func LoadModuleConfig(filePath string) (ModuleConfig, error) {
log.Fatal("")
}

if !ValidateZeroVersion(config) {
constraint := config.ZeroVersion.Constraints.String()
return config, errors.New(fmt.Sprintf("Module's zero requirement not satisfied: expected %s received: %s", constraint, version.AppVersion))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add some more details, we are telling them a bit about what's wrong but not how to fix it, and it will be the user who is faced with this message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about this
image

return err
}

constraints, constErr := goVerson.NewConstraint(versionString)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the module.yml doesn't have a version specified we should probably just skip the check.

@davidcheung davidcheung merged commit 8fb6adb into main Mar 25, 2021
@davidcheung davidcheung deleted the version-requirements branch March 25, 2021 16:09
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