X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=internal%2Fversion%2Fversion.go;fp=version%2Fversion.go;h=71480194f4c4e0b1b33cddcceff183c3d905625f;hb=d1f24d37bd447b64e402298bb8eb2479681facf9;hp=8bde72c371362abc2dd1f917361e80b1ca442a57;hpb=1548c7e12531e3d055567d761c580a1c7ff0ac40;p=govpp.git diff --git a/version/version.go b/internal/version/version.go similarity index 83% rename from version/version.go rename to internal/version/version.go index 8bde72c..7148019 100644 --- a/version/version.go +++ b/internal/version/version.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Package version keeps track of versioning info for GoVPP. package version import ( @@ -21,6 +22,22 @@ import ( "time" ) +const ( + Major = 0 + Minor = 4 + Patch = 0 + PreRelease = "dev" +) + +// String formats the version string using semver format. +func String() string { + v := fmt.Sprintf("v%d.%d.%d", Major, Minor, Patch) + if PreRelease != "" { + v += "-" + PreRelease + } + return v +} + // Following variables should normally be updated via `-ldflags "-X ..."`. // However, the version string is hard-coded to ensure it is always included // even with bare go build/install.