-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/cue: better error message for mismatched publish version
The error messages did not make it that clear what the issue was when there's a version mismatch between the version argument passed to `cue mod publish` and the major version in the module file. Example of old error message: cannot form module version: mismatched major version suffix in "mod.example/blah" (version v1.0.0) Example of new message: publish version "v1.0.0" does not match implied major version "v0" in "cue.mod/module.cue"; must be v0.N.N Also improve a couple of other error messages in this area, making clear that a canonical semver is required. Fixes #3225 Signed-off-by: Roger Peppe <[email protected]> Change-Id: Id84166be9e5c97216d170a8968ec44354a56cb82 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1197924 TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Daniel Martí <[email protected]>
- Loading branch information
Showing
3 changed files
with
43 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
cmd/cue/cmd/testdata/script/modpublish_invalid_version.txtar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
memregistry MEMREGISTRY | ||
env CUE_REGISTRY=$MEMREGISTRY+insecure | ||
|
||
! exec cue mod publish 1.2.3 | ||
cmp stderr want-stderr-1 | ||
|
||
! exec cue mod publish v1.2 | ||
cmp stderr want-stderr-2 | ||
|
||
! exec cue mod publish v1.2.3+build | ||
cmp stderr want-stderr-3 | ||
|
||
-- want-stderr-1 -- | ||
invalid publish version "1.2.3"; must be valid semantic version (see http://semver.org) | ||
-- want-stderr-2 -- | ||
publish version "v1.2" is not in canonical form | ||
-- want-stderr-3 -- | ||
publish version "v1.2.3+build" is not in canonical form | ||
-- cue.mod/module.cue -- | ||
module: "test.example" | ||
language: version: "v0.9.2" | ||
-- main.cue -- | ||
package main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters