Help us shape the future of Go! Take the 2026 Go Developer Survey

version

package
v1.65.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package version implements the 'eng version' command, which displays the application's version information and checks for available updates.

Index

Constants

This section is empty.

Variables

View Source
var VersionCmd = &cobra.Command{
	Use:   "version",
	Short: "Print the version number of eng and check for updates",
	Long: `Displays the application's version, build commit, build date, Go version,
and target OS/Architecture.

It also checks the GitHub repository (eng618/eng) for the latest official release
and compares it with the currently running version.

If a newer version is available, you can use the --update flag to attempt
an automatic upgrade via Homebrew (if installed that way) or via the
install script (if installed via curl).`,
	Run: func(cmd *cobra.Command, _args []string) {
		isVerbose, _ := cmd.Flags().GetBool("verbose")

		printVersionInfo(isVerbose)

		var sp *ui.Spinner
		if !ui.DisableProgress {
			sp = ui.NewSpinner("Checking for latest version...")
			sp.Start()
		}
		latestRelease, err := getLatestRelease(githubRepoOwner, githubRepoName, isVerbose)
		if sp != nil {
			sp.Stop()
		}

		if err != nil {
			log.Warn("Could not check for updates: %v", err)
			return
		}

		if latestRelease == nil || latestRelease.TagName == "" {
			log.Warn("Could not determine the latest release version from GitHub.")
			return
		}

		if appversion.Version == "dev" {
			handleDevVersion(latestRelease)
			return
		}

		currentSemVer, latestSemVer, err := parseVersions(appversion.Version, latestRelease.TagName)
		if err != nil {

			log.Info("Latest release is %s: %s", latestRelease.TagName, latestRelease.HTMLURL)
			return
		}

		compareAndHandleUpdate(currentSemVer, latestSemVer, latestRelease, isVerbose)
	},
}

VersionCmd represents the Cobra command for 'eng version'. It displays the current version details and checks GitHub for the latest release. Includes an optional --update flag to attempt an update via Homebrew.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL