mirror of
https://github.com/securego/gosec.git
synced 2024-12-24 11:35:52 +00:00
Fix panic when reading the version from debug info in Go 1.13
Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
parent
55d368f2e5
commit
3784ffea4e
1 changed files with 5 additions and 6 deletions
|
@ -1,9 +1,5 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
|
||||||
"runtime/debug"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Version is the build version
|
// Version is the build version
|
||||||
var Version string
|
var Version string
|
||||||
|
|
||||||
|
@ -19,7 +15,10 @@ var BuildDate string
|
||||||
// https://github.com/golang/go/issues/29814 gets resolved.
|
// https://github.com/golang/go/issues/29814 gets resolved.
|
||||||
func prepareVersionInfo() {
|
func prepareVersionInfo() {
|
||||||
if Version == "" {
|
if Version == "" {
|
||||||
bi, _ := debug.ReadBuildInfo()
|
// bi, _ := debug.ReadBuildInfo()
|
||||||
Version = bi.Main.Version
|
// Version = bi.Main.Version
|
||||||
|
// TODO use the debug information when it will provide more details
|
||||||
|
// It seems to panic with Go 1.13.
|
||||||
|
Version = "dev"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue