refactor(bonfire): read build info through a package variable
BuildVersion calls readBuildInfo (debug.ReadBuildInfo) so tests can pin the tagged, replaced and go.work cases. No behaviour change.
This commit is contained in:
@@ -7,6 +7,9 @@ import (
|
||||
// frameworkModule is the module path of the SummerCMS framework.
|
||||
const frameworkModule = "git.golem15.com/golem15/summercms"
|
||||
|
||||
// readBuildInfo reads the binary's build information; tests replace it.
|
||||
var readBuildInfo = debug.ReadBuildInfo
|
||||
|
||||
// Version is the version line of a binary: the application's own version and
|
||||
// the framework version it was built against.
|
||||
type Version struct {
|
||||
@@ -26,7 +29,7 @@ type Version struct {
|
||||
// the version of the git.golem15.com/golem15/summercms dependency, or App
|
||||
// when the main module is the framework itself. "(devel)" reads as "devel".
|
||||
func BuildVersion() Version {
|
||||
info, ok := debug.ReadBuildInfo()
|
||||
info, ok := readBuildInfo()
|
||||
if !ok {
|
||||
return Version{App: "devel", Framework: "devel"}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user