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