Prepare for release (#37)

* Prepare for release

Added LICENSE, set version and configured GoReleaser/Docker

* Updated LICENSE
This commit is contained in:
Fedor Korotkov
2023-03-20 15:28:24 -04:00
committed by GitHub
parent fb3056d3ae
commit bdc781214c
9 changed files with 191 additions and 1 deletions
+33
View File
@@ -0,0 +1,33 @@
package version
import (
"fmt"
goversion "github.com/hashicorp/go-version"
"runtime/debug"
)
var (
Version = "unknown"
Commit = "unknown"
FullVersion = ""
)
//nolint:gochecknoinits
func init() {
if Version == "unknown" {
info, ok := debug.ReadBuildInfo()
if ok {
// We parse the version here for two reasons:
// * to weed out the "(devel)" version and fallback to "unknown" instead
// (see https://github.com/golang/go/issues/29228 for details on when this might happen)
// * to remove the "v" prefix from the BuildInfo's version (e.g. "v0.7.0") and thus be consistent
// with the binary builds, where the version string would be "0.7.0" instead
semver, err := goversion.NewSemver(info.Main.Version)
if err == nil {
Version = semver.String()
}
}
}
FullVersion = fmt.Sprintf("%s-%s", Version, Commit)
}