Skip to content

Commit

Permalink
fix: dupl on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Dec 16, 2024
1 parent 225f0f9 commit 54579a1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/golinters/dupl/dupl.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package dupl
import (
"fmt"
"go/token"
"strings"
"sync"

duplAPI "github.com/golangci/dupl"
Expand Down Expand Up @@ -68,6 +69,11 @@ func runDupl(pass *analysis.Pass, settings *config.DuplSettings) ([]goanalysis.I
res := make([]goanalysis.Issue, 0, len(issues))

for _, i := range issues {
// Related to Windows
if !strings.HasSuffix(i.To.Filename(), ".go") {
continue
}

toFilename, err := fsutils.ShortestRelPath(i.To.Filename(), "")
if err != nil {
return nil, fmt.Errorf("failed to get shortest rel path for %q: %w", i.To.Filename(), err)
Expand Down

0 comments on commit 54579a1

Please sign in to comment.