|
53 | 53 | // |
54 | 54 | // For more information on semantic versioning, see https://semver.org. |
55 | 55 | // |
| 56 | +// Note: gorelease does not accept build metadata in releases (like |
| 57 | +// v1.0.0+debug). Although it is valid semver, the Go tool and other tools in |
| 58 | +// the ecosystem do not support it, so its use is not recommended. |
| 59 | +// |
56 | 60 | // gorelease accepts the following flags: |
57 | 61 | // |
58 | 62 | // -base=version: The version that the current version of the module will be |
@@ -167,6 +171,9 @@ func runRelease(w io.Writer, dir string, args []string) (success bool, err error |
167 | 171 | return false, usageErrorf("no arguments allowed") |
168 | 172 | } |
169 | 173 | if releaseVersion != "" { |
| 174 | + if semver.Build(releaseVersion) != "" { |
| 175 | + return false, usageErrorf("release version %q is not a canonical semantic version: build metadata is not supported", releaseVersion) |
| 176 | + } |
170 | 177 | if c := semver.Canonical(releaseVersion); c != releaseVersion { |
171 | 178 | return false, usageErrorf("release version %q is not a canonical semantic version", releaseVersion) |
172 | 179 | } |
@@ -250,6 +257,11 @@ func loadLocalModule(modRoot, repoRoot, version string) (m moduleInfo, err error |
250 | 257 | version: version, |
251 | 258 | goModPath: filepath.Join(modRoot, "go.mod"), |
252 | 259 | } |
| 260 | + |
| 261 | + if version != "" && semver.Compare(version, "v0.0.0-99999999999999-zzzzzzzzzzzz") < 0 { |
| 262 | + m.diagnostics = append(m.diagnostics, fmt.Sprintf("Version %s is lower than most pseudo-versions. Consider releasing v0.1.0-0 instead.", version)) |
| 263 | + } |
| 264 | + |
253 | 265 | m.goModData, err = ioutil.ReadFile(m.goModPath) |
254 | 266 | if err != nil { |
255 | 267 | return moduleInfo{}, err |
|
0 commit comments