goversioningldflags

Go - "version" package and How it works?


I am researching approaches to organize projects in different open source projects (for example operator-framework/operator-sdk) and sometime find version package with version.go file:

├── build
├── cmd
├── deploy
├── go.mod
├── go.sum
├── pkg
├── tools.go
└── version
    └── version.go

package version

var (
    Version = "0.0.1"
)

I tried to find how to use it to control application version, but found only approach uses -ldflags.

Are exist other ways to use version package and version.go file?


Solution

  • Are exists other ways to use version package and version.go file?

    No.