File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -269,8 +269,6 @@ func getDepMode() DependencyInstallerMode {
269
269
270
270
// Tries to open `go.mod` and read a go directive, returning the version and whether it was found.
271
271
func tryReadGoDirective (depMode DependencyInstallerMode ) (string , bool ) {
272
- version := ""
273
- found := false
274
272
if depMode == GoGetWithModules {
275
273
versionRe := regexp .MustCompile (`(?m)^go[ \t\r]+([0-9]+\.[0-9]+)$` )
276
274
goMod , err := os .ReadFile ("go.mod" )
@@ -279,14 +277,13 @@ func tryReadGoDirective(depMode DependencyInstallerMode) (string, bool) {
279
277
} else {
280
278
matches := versionRe .FindSubmatch (goMod )
281
279
if matches != nil {
282
- found = true
283
280
if len (matches ) > 1 {
284
- version = string (matches [1 ])
281
+ return string (matches [1 ]), true
285
282
}
286
283
}
287
284
}
288
285
}
289
- return version , found
286
+ return "" , false
290
287
}
291
288
292
289
// Returns the appropriate ModMode for the current project
You can’t perform that action at this time.
0 commit comments