Skip to content

Commit d464c12

Browse files
committed
feat: better Go detection
1 parent 10219c8 commit d464c12

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

pkg/config/config.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package config
22

33
import (
4+
"os"
45
"strings"
56

67
hcversion "github.com/hashicorp/go-version"
@@ -54,16 +55,16 @@ func IsGreaterThanOrEqualGo118(v string) bool {
5455
}
5556

5657
func DetectGoVersion() string {
57-
const defaultGo = "1.17"
58-
59-
file, err := gomoddirectives.GetModuleFile()
60-
if err != nil {
61-
return defaultGo
62-
}
58+
file, _ := gomoddirectives.GetModuleFile()
6359

6460
if file != nil && file.Go != nil {
6561
return file.Go.Version
6662
}
6763

68-
return defaultGo
64+
v := os.Getenv("GOVERSION")
65+
if v != "" {
66+
return v
67+
}
68+
69+
return "1.17"
6970
}

0 commit comments

Comments
 (0)