-
Notifications
You must be signed in to change notification settings - Fork 53
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
Version requirements #357
Conversation
5ce770c
to
725a6b2
Compare
@@ -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}" |
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.
For real releases this actually gets set by .goreleaser.yml, not the Makefile.
docs/module-definition.md
Outdated
| `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 | |
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.
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)) |
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.
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.
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.
return err | ||
} | ||
|
||
constraints, constErr := goVerson.NewConstraint(versionString) |
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.
If the module.yml doesn't have a version specified we should probably just skip the check.
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