Add versioning infrastructure in Go

https://github.com/containers/toolbox/pull/318
This commit is contained in:
Harry Míchal 2020-04-07 20:01:41 +02:00 committed by Debarshi Ray
parent 1b6d7d6410
commit 53f4d0c2f0
3 changed files with 40 additions and 1 deletions

View file

@ -1,6 +1,6 @@
project( project(
'toolbox', 'toolbox',
version: '0.0.18', version: '0.0.90',
license: 'ASL 2.0', license: 'ASL 2.0',
meson_version: '>= 0.40.0', meson_version: '>= 0.40.0',
) )

View file

@ -4,6 +4,7 @@ go_build_wrapper_program = find_program('go-build-wrapper')
sources = files( sources = files(
'toolbox.go', 'toolbox.go',
'cmd/root.go', 'cmd/root.go',
'pkg/version/version.go',
) )
if go.found() if go.found()

View file

@ -0,0 +1,38 @@
/*
* Copyright © 2019 2020 Red Hat Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package version
import "fmt"
// Version is the version of Toolbox
type Version struct {
Major int
Minor int
Micro int
}
// CurrentVersion holds the information about current build version
var CurrentVersion = Version{
Major: 0,
Minor: 0,
Micro: 90,
}
// GetVersion returns string with the version of Toolbox
func GetVersion() string {
return fmt.Sprintf("%d.%d.%d", CurrentVersion.Major, CurrentVersion.Minor, CurrentVersion.Micro)
}