File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -273,13 +273,7 @@ func IdentifyEnvironment() {
273
273
defer project .RemoveTemporaryExtractorFiles ()
274
274
275
275
// 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 )
283
277
v .goModVersion , v .goModVersionFound = greatestGoVersion .Version , greatestGoVersion .Found
284
278
285
279
// 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 {
89
89
return GoVersionInfo {Version : "" , Found : false }
90
90
}
91
91
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
+
92
105
// Determines whether any of the directory paths in the input are nested.
93
106
func checkDirsNested (inputDirs []string ) (string , bool ) {
94
107
// 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