From f1c1ec18719459a1b0da202e9534710d240e90e3 Mon Sep 17 00:00:00 2001 From: rhysd Date: Sat, 30 Dec 2017 12:31:07 +0900 Subject: [PATCH] add introduction to godoc --- README.md | 6 ++++-- selfupdate/doc.go | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 selfupdate/doc.go diff --git a/README.md b/README.md index 2d8050a..fedee20 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,6 @@ If newer version than itself is detected, it downloads released binary from GitH - Many archive and compression formats are supported (zip, gzip, tar) [go-github-selfupdate]: https://github.com/rhysd/go-github-selfupdate -[semantic versioning]: https://semver.org/ [GitHub Releases API]: https://developer.github.com/v3/repos/releases/ ## Try Out Example @@ -117,6 +116,9 @@ Prefix before version number `\d+\.\d+\.\d+` is automatically omitted. For examp Tags which don't contain a version number are ignored (i.e. `nightly`). And releases marked as `pre-release` are also ignored. +[semantic versioning]: https://semver.org/ + + ### Structure of Releases In summary, structure of releases on GitHub looks like: @@ -176,5 +178,5 @@ tj/go-update: -[GoDoc]: https://godoc.org/github.com/rhysd/go-github-selfupdate +[GoDoc]: https://godoc.org/github.com/rhysd/go-github-selfupdate/selfupdate diff --git a/selfupdate/doc.go b/selfupdate/doc.go new file mode 100644 index 0000000..e162a45 --- /dev/null +++ b/selfupdate/doc.go @@ -0,0 +1,34 @@ +/* +Package selfupdate provides self-update mechanism to Go command line tools. + +Go does not provide the way to install/update the stable version of tools. By default, Go command line tools are updated + +- using `go get -u` (updating to HEAD) +- using system's package manager (depending on the platform) +- downloading executables from GitHub release page manually + +By using this library, you will get 4th choice: + +- from your command line tool directly (and automatically) + +go-github-selfupdate detects the information of the latest release via GitHub Releases API and check the current version. +If newer version than itself is detected, it downloads released binary from GitHub and replaces itself. + +- Automatically detects the latest version of released binary on GitHub +- Retrieve the proper binary for the OS and arch where the binary is running +- Update the binary with rollback support on failure +- Tested on Linux, macOS and Windows +- Many archive and compression formats are supported (zip, gzip, tar) + +There are some naming rules. Please read following links. + +Naming Rules of Released Binaries: + https://github.com/rhysd/go-github-selfupdate#naming-rules-of-released-binaries + +Naming Rules of Git Tags: + https://github.com/rhysd/go-github-selfupdate#naming-rules-of-git-tags + +This package is hosted on GitHub: + https://github.com/rhysd/go-github-selfupdate +*/ +package selfupdate