v1.1.0
π Version 1.1.0 is now available!
β¨ Key highlights
Extra fields support!
Each project may want to display more information such as documentation or changelog URLs, sometimes even domain related fields.
Now you can provide them using your Go struct! You can also use a brand-new pretty
tag to define the field name for Pretty output.
type Custom struct {
// In the pretty mode, fields are printed in the same order as defined in struct.
BuiltBy string `json:"builtBy" yaml:"builtBy" pretty:"Built By"`
RepoURL string `json:"repoURL" yaml:"repoURL" pretty:"Repository URL"`
DocsURL string `json:"docsURL" yaml:"docsURL" pretty:"Documentation URL"`
}
func main() {
custom := Custom{
RepoURL: "https://github.com/mszostok/version",
DocsURL: "https://szostok.io/projects/version",
BuiltBy: "GoReleaser",
}
info := version.Get()
info.ExtraFields = custom
// ...
Learn more at version.szostok.io/customization/extra-fields.
Upgrade notice simplifications
Fetching the release information was changed from GET https://api.github.com/repos/{owner}/{repo}/releases/latest
to HEAD https://github.com/{owner}/{repo}/releases/latest
.
As a result, such call cannot hit rate limits set by GitHub for unauthorized calls. Additionally, I don't create the state file as it's not needed, and the call can be always executed. However, you can still enable caching via upgrade.WithMinElapseTimeForRecheck
.
Deprecation
The LookForLatestRelease
method is deprecated, will be removed in 1.4.0 release. It's only about naming, see:
Old: LookForLatestRelease(upgrade.LookForLatestReleaseInput{CurrentVersion: currentVersion})
New: LookForGreaterRelease(upgrade.LookForGreaterReleaseInput{CurrentVersion: currentVersion})
Install
To add the version
package, run:
go get go.szostok.io/[email protected]
Next visit version.szostok.io/quick-start for the most popular way of the setup.
Changelog
Enhancements π
- Add option to provide extra fields in Info object by @mszostok in #28
- Change the GitHub release fetcher by @mszostok in #33
- Add
isSmartTerminal
to post render hook by @mszostok in #35 - Add
isSmartTerminal
to upgrade render funcs by @mszostok in #36 - Serve cached upgrade notice, fix config dir by @mszostok in #50
- Refactor GitHub upgrade detector by @mszostok in #52
- Add cobra hooks, document options by @mszostok in #53
- Add docs for extra fields by @mszostok in #29
Fixed Bugs π
Other Changes β¨
Test coverage related activities
- Introduce e2e tests and test all examples in colors and without colors by @mszostok in #37
- Test recheck interval, update README by @mszostok in #42
- Add full unit test coverage for printer package by @mszostok in #44
- Add unit test for cobra package by @mszostok in #45
- Add .exe suffix when running on Windows by @mszostok in #38
- Add coverall CI pipeline by @mszostok in #54
Full Changelog: v1.0.0...v1.1.0