From b63b1ef8c7571163b744e840e7b37012245eb649 Mon Sep 17 00:00:00 2001 From: Denis Vaumoron Date: Fri, 31 May 2024 22:14:02 +0200 Subject: [PATCH] prepare first release --- .gitignore | 2 ++ .goreleaser.yaml | 75 ++++++++++++++++++++++++++++++++++++++++ README.md | 37 ++++++++++++++++++++ pkg/goversion/version.go | 2 +- 4 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 .goreleaser.yaml diff --git a/.gitignore b/.gitignore index cab4aa5..58122b8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ # Dependency directories (remove the comment below to include it) # vendor/ + +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..efa2fc2 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,75 @@ +# The lines below are called `modelines`. See `:help modeline` +# Feel free to remove those if you don't want/need to use them. +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj + +version: 1 + +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy + +builds: + - main: ./cmd/go + binary: go + env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + - freebsd + - openbsd + - solaris + + goarch: + - "386" + - amd64 + - arm + - arm64 + +release: + name_template: "Release {{.Tag}}" + +changelog: + use: github-native + +archives: + - format: zip + name_template: "{{ .ProjectName }}_{{ .Version }}_{{- .Os }}_{{- .Arch }}" + +nfpms: + - file_name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Arch }}' + maintainer: 'https://github.com/dvaumoron' + homepage: https://github.com/dvaumoron/lastgo + description: >- + lastgo provides an alternative go command which is a proxy keeping up to date the Go toolchain (see https://go.dev). + license: "Apache-2.0" + formats: + - deb + - rpm + - apk + bindir: /usr/bin + section: default + contents: + - src: ./LICENSE + dst: /usr/share/doc/gosince/copyright + file_info: + mode: 0444 + rpm: + signature: + key_file: "{{ if index .Env \"GPG_KEY_FILE\" }}{{.Env.GPG_KEY_FILE}}{{ end }}" + deb: + signature: + key_file: "{{ if index .Env \"GPG_KEY_FILE\" }}{{.Env.GPG_KEY_FILE}}{{ end }}" + +brews: + - repository: + owner: dvaumoron + name: homebrew-tap + directory: Formula + homepage: https://github.com/dvaumoron/lastgo + description: provides an alternative go command which is a proxy keeping up to date the Go toolchain (see https://go.dev). + license: "Apache-2.0" + commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}" diff --git a/README.md b/README.md index a545f31..5aa4508 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,40 @@ # lastgo The **lastgo** project provides an alternative `go` command which is a proxy keeping up to date the [Go](https://go.dev) toolchain. + +## Getting started + +Install via [Homebrew](https://brew.sh) + +```console +$ brew tap dvaumoron/tap +$ brew install lastgo +``` + +Or get the [last binary](https://github.com/dvaumoron/lastgo/releases) depending on your OS. + +## Environment Variables + +### LASTGO_ASK + +String (Default: "") + +When non empty, **lastgo** ask user for confirmation before an update. + +### LASTGO_CHECK_INTERVAL + +String (Default: 24h) + +Minimum interval waited between check of last version on `LASTGO_DOWNLOAD_URL`. + +### LASTGO_DOWNLOAD_URL + +String (Default: https://go.dev/dl) + +URL to download Go binary (only used to install at first launch, update rely on **Go** `GOTOOLCHAIN` mecanism). + +### LASTGO_ROOT + +String (Default: ${HOME}/.lastgo) + +Path to directory where **lastgo** install `go`. diff --git a/pkg/goversion/version.go b/pkg/goversion/version.go index b06bb02..f0f2df8 100644 --- a/pkg/goversion/version.go +++ b/pkg/goversion/version.go @@ -33,7 +33,7 @@ type version struct { } func init() { - versionRegexp = regexp.MustCompilePOSIX("go[0-9]+(\\.[0-9]+)*") + versionRegexp = regexp.MustCompilePOSIX("go[0-9]+\\.[0-9]+(\\.[0-9]+)?") } // return a go version (like "go1.22.3").