Skip to content

v1.1.0

Compare
Choose a tag to compare
@mszostok mszostok released this 01 Oct 16:03
· 10 commits to main since this release
f21cf44

πŸŽ‰ 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 πŸš€

Fixed Bugs πŸ›

  • Fix setting CLI name via ldflags, fix CLI name for cobra examples by @mszostok in #40

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