File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -58,14 +58,14 @@ type GoVersionInfo struct {
58
58
// 1. The Go version specified in the `go.work` file, if any.
59
59
// 2. The greatest Go version specified in any `go.mod` file, if any.
60
60
func (workspace * GoWorkspace ) RequiredGoVersion () GoVersionInfo {
61
- if workspace .WorkspaceFile != nil {
61
+ if workspace .WorkspaceFile != nil && workspace . WorkspaceFile . Go != nil {
62
62
// If we have parsed a `go.work` file, return the version number from it.
63
63
return GoVersionInfo {Version : workspace .WorkspaceFile .Go .Version , Found : true }
64
64
} else if workspace .Modules != nil && len (workspace .Modules ) > 0 {
65
65
// Otherwise, if we have `go.work` files, find the greatest Go version in those.
66
66
var greatestVersion string = ""
67
67
for _ , module := range workspace .Modules {
68
- if module .Module != nil {
68
+ if module .Module != nil && module . Module . Go != nil {
69
69
// If we have parsed the file, retrieve the version number we have already obtained.
70
70
if greatestVersion == "" || semver .Compare ("v" + module .Module .Go .Version , "v" + greatestVersion ) > 0 {
71
71
greatestVersion = module .Module .Go .Version
You can’t perform that action at this time.
0 commit comments