Fabric CLI can already be installed using go command:
$ go install github.com/blackstork-io/fabric@latest
# or
$ go install github.com/blackstork-io/fabric@v0.4.0-rev0
But the version is always set to:
$ fabric --version
fabric version v0.0.0-dev
We can use runtime/debug std package and retrieve main module version. For example:
package main
import "runtime/debug"
var version string
func main() {
// ...
}
func init() {
info, ok := debug.ReadBuildInfo()
if !ok {
version = "0.0.0-dev"
return
}
version = info.Main.Version
}
Fabric CLI can already be installed using
go
command:But the version is always set to:
We can use
runtime/debug
std package and retrievemain
module version. For example:More info: https://pkg.go.dev/runtime/debug#ReadBuildInfo