AT Protocol IPLD-CAR Repository toolkit (CLI)

version number

tree 078e3bab b542ac0c

Changed files
+18 -11
.github
workflows
cmd
util
version
+3 -1
.github/workflows/release.yaml
··· 28 28 goos: ${{ matrix.goos }} 29 29 goarch: ${{ matrix.goarch }} 30 30 project_path: "./cmd" 31 - binary_name: atr 31 + binary_name: atr 32 + sha256sum: true 33 + md5sum: false
+3 -2
cmd/atr.go
··· 19 19 "github.com/alecthomas/chroma/lexers" 20 20 "github.com/alecthomas/chroma/styles" 21 21 repo "github.com/atscan/atr/repo" 22 - "github.com/atscan/atr/util/version" 23 22 "github.com/dustin/go-humanize" 24 23 "github.com/fatih/color" 25 24 "github.com/ipfs/go-cid" ··· 29 28 "github.com/urfave/cli/v2" 30 29 ) 31 30 31 + var _version string 32 + 32 33 func main() { 33 34 34 35 app := &cli.App{ 35 36 Name: "atr", 36 37 Usage: "AT Protocol IPLD-CAR Repository toolkit", 37 - Version: version.Version, 38 + Version: _version, 38 39 Flags: []cli.Flag{ 39 40 &cli.StringFlag{ 40 41 Name: "C",
+12 -8
util/version/version.go
··· 4 4 "runtime/debug" 5 5 ) 6 6 7 - // Version holds the version number. 8 - var Version string 9 - 10 - func init() { 11 - if Version == "" { 12 - Version = "dev-" + revision() 13 - } 14 - } 7 + // v holds the version number. 8 + var v string 15 9 16 10 func revision() string { 17 11 info, ok := debug.ReadBuildInfo() ··· 25 19 } 26 20 return "" 27 21 } 22 + 23 + func Version(version string) string { 24 + if version != "" { 25 + v = version 26 + } 27 + if v == "" { 28 + v = "dev-" + revision() 29 + } 30 + return v 31 + }