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

update

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package update 提供 GitHub Release 更新检查功能。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckResult

type CheckResult struct {
	CurrentVersion string      `json:"currentVersion"`
	Latest         ReleaseInfo `json:"latest"`
	HasUpdate      bool        `json:"hasUpdate"`
}

CheckResult 是更新检查的结果。

func CheckLatest

func CheckLatest(logger *slog.Logger) (*CheckResult, error)

CheckLatest 检查 GitHub 上是否有新版本。 返回 CheckResult(无论是否有更新),网络/解析错误时返回 error。 前端根据场景决定是否展示错误。

type ReleaseInfo

type ReleaseInfo struct {
	TagName     string `json:"tag_name"`
	Name        string `json:"name"`
	Body        string `json:"body"`     // markdown 格式的 release notes
	HTMLURL     string `json:"html_url"` // release 页面 URL
	PublishedAt string `json:"published_at"`
}

ReleaseInfo 表示一个 GitHub Release 的简要信息。

Jump to

Keyboard shortcuts

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