mirror of
https://github.com/mgechev/revive.git
synced 2025-07-17 01:12:27 +02:00
refactor: simplify with strings.Prefix, strings.CutPrefix (#1137)
This commit is contained in:
@ -189,10 +189,7 @@ func getVersion(builtBy, date, commit, version string) string {
|
||||
if version == defaultVersion {
|
||||
bi, ok := debug.ReadBuildInfo()
|
||||
if ok {
|
||||
version = bi.Main.Version
|
||||
if strings.HasPrefix(version, "v") {
|
||||
version = strings.TrimLeft(bi.Main.Version, "v")
|
||||
}
|
||||
version = strings.TrimPrefix(bi.Main.Version, "v")
|
||||
if len(buildInfo) == 0 {
|
||||
return fmt.Sprintf("version %s\n", version)
|
||||
}
|
||||
|
Reference in New Issue
Block a user