@@ -18,6 +18,7 @@ import (
18
18
"golang.org/x/tools/gopls/internal/label"
19
19
"golang.org/x/tools/gopls/internal/protocol"
20
20
"golang.org/x/tools/gopls/internal/protocol/command"
21
+ "golang.org/x/tools/gopls/internal/util/moreslices"
21
22
"golang.org/x/tools/internal/event"
22
23
"golang.org/x/tools/internal/memoize"
23
24
)
@@ -380,8 +381,8 @@ func (s *Snapshot) matchErrorToModule(pm *ParsedModule, goCmdError string) (prot
380
381
var reference * modfile.Line
381
382
matches := moduleVersionInErrorRe .FindAllStringSubmatch (goCmdError , - 1 )
382
383
383
- for i := len (matches ) - 1 ; i >= 0 ; i -- {
384
- ver := module.Version {Path : matches [ i ][ 1 ], Version : matches [ i ] [2 ]}
384
+ for _ , match := range moreslices . Reversed (matches ) {
385
+ ver := module.Version {Path : match [ 1 ], Version : match [2 ]}
385
386
if err := module .Check (ver .Path , ver .Version ); err != nil {
386
387
continue
387
388
}
@@ -412,8 +413,8 @@ func (s *Snapshot) matchErrorToModule(pm *ParsedModule, goCmdError string) (prot
412
413
func (s * Snapshot ) goCommandDiagnostic (pm * ParsedModule , loc protocol.Location , goCmdError string ) (* Diagnostic , error ) {
413
414
matches := moduleVersionInErrorRe .FindAllStringSubmatch (goCmdError , - 1 )
414
415
var innermost * module.Version
415
- for i := len (matches ) - 1 ; i >= 0 ; i -- {
416
- ver := module.Version {Path : matches [ i ][ 1 ], Version : matches [ i ] [2 ]}
416
+ for _ , match := range moreslices . Reversed (matches ) {
417
+ ver := module.Version {Path : match [ 1 ], Version : match [2 ]}
417
418
if err := module .Check (ver .Path , ver .Version ); err != nil {
418
419
continue
419
420
}
0 commit comments