Skip to content

Using upstream dupl #1552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ require (
github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b
github.com/gofrs/flock v0.8.0
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a
github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6
github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613
github.com/golangci/gocyclo v0.0.0-20180528144436-0a533e8fa43d
Expand All @@ -36,6 +35,7 @@ require (
github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb // v1.0
github.com/mattn/go-colorable v0.1.8
github.com/mbilski/exhaustivestruct v1.1.0
github.com/mibk/dupl v1.0.0
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/go-ps v1.0.0
github.com/moricho/tparallel v0.2.1
Expand Down Expand Up @@ -75,3 +75,5 @@ require (
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect
mvdan.cc/unparam v0.0.0-20200501210554-b37ab49443f7
)

replace github.com/mibk/dupl => github.com/iwankgb/dupl v0.0.0-20201212183150-dacd1b4f3f54
4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions pkg/golinters/dupl.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"go/token"
"sync"

duplAPI "github.com/golangci/dupl"
duplAPI "github.com/mibk/dupl/api"
"github.com/pkg/errors"
"golang.org/x/tools/go/analysis"

Expand Down Expand Up @@ -49,22 +49,22 @@ func NewDupl() *goanalysis.Linter {

res := make([]goanalysis.Issue, 0, len(issues))
for _, i := range issues {
toFilename, err := fsutils.ShortestRelPath(i.To.Filename(), "")
toFilename, err := fsutils.ShortestRelPath(i.To.Filename, "")
if err != nil {
return nil, errors.Wrapf(err, "failed to get shortest rel path for %q", i.To.Filename())
return nil, errors.Wrapf(err, "failed to get shortest rel path for %q", i.To.Filename)
}
dupl := fmt.Sprintf("%s:%d-%d", toFilename, i.To.LineStart(), i.To.LineEnd())
dupl := fmt.Sprintf("%s:%d-%d", toFilename, i.To.LineStart, i.To.LineEnd)
text := fmt.Sprintf("%d-%d lines are duplicate of %s",
i.From.LineStart(), i.From.LineEnd(),
i.From.LineStart, i.From.LineEnd,
formatCode(dupl, lintCtx.Cfg))
res = append(res, goanalysis.NewIssue(&result.Issue{
Pos: token.Position{
Filename: i.From.Filename(),
Line: i.From.LineStart(),
Filename: i.From.Filename,
Line: i.From.LineStart,
},
LineRange: &result.Range{
From: i.From.LineStart(),
To: i.From.LineEnd(),
From: i.From.LineStart,
To: i.From.LineEnd,
},
Text: text,
FromLinter: duplLinterName,
Expand Down