File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -273,13 +273,7 @@ func IdentifyEnvironment() {
273273 defer project .RemoveTemporaryExtractorFiles ()
274274
275275 // Find the greatest Go version required by any of the workspaces.
276- greatestGoVersion := project.GoVersionInfo {Version : "" , Found : false }
277- for _ , workspace := range workspaces {
278- goVersionInfo := workspace .RequiredGoVersion ()
279- if goVersionInfo .Found && (! greatestGoVersion .Found || semver .Compare ("v" + goVersionInfo .Version , "v" + greatestGoVersion .Version ) > 0 ) {
280- greatestGoVersion = goVersionInfo
281- }
282- }
276+ greatestGoVersion := project .RequiredGoVersion (& workspaces )
283277 v .goModVersion , v .goModVersionFound = greatestGoVersion .Version , greatestGoVersion .Found
284278
285279 // Find which, if any, version of Go is installed on the system already.
Original file line number Diff line number Diff line change @@ -89,6 +89,19 @@ func (workspace *GoWorkspace) RequiredGoVersion() GoVersionInfo {
8989 return GoVersionInfo {Version : "" , Found : false }
9090}
9191
92+ // Finds the greatest Go version required by any of the given `workspaces`.
93+ // Returns a `GoVersionInfo` value with `Found: false` if no version information is available.
94+ func RequiredGoVersion (workspaces * []GoWorkspace ) GoVersionInfo {
95+ greatestGoVersion := GoVersionInfo {Version : "" , Found : false }
96+ for _ , workspace := range * workspaces {
97+ goVersionInfo := workspace .RequiredGoVersion ()
98+ if goVersionInfo .Found && (! greatestGoVersion .Found || semver .Compare ("v" + goVersionInfo .Version , "v" + greatestGoVersion .Version ) > 0 ) {
99+ greatestGoVersion = goVersionInfo
100+ }
101+ }
102+ return greatestGoVersion
103+ }
104+
92105// Determines whether any of the directory paths in the input are nested.
93106func checkDirsNested (inputDirs []string ) (string , bool ) {
94107 // replace "." with "" so that we can check if all the paths are nested
You can’t perform that action at this time.
0 commit comments