alecthomas / gometalinter

DEPRECATED: Use https://github.com/golangci/golangci-lint
MIT License
3.51k stars 267 forks source link

The final output string created from template is exclude or include target #504

Closed junpayment closed 6 years ago

junpayment commented 6 years ago

Hi

For example I ran like below.

gometalinter ./... --exclude='^vendor' --format=$PWD/'{{.Path}}:{{.Line}}:{{if .Col}}{{.Col}}{{end}}:{{.Severity}}: {{.Message}} ({{.Linter}})'

I expected that results of vendor libraries were not include in the output. But displayed them.

I think that it is because the final output result is subject to regular expression with the following code.

https://github.com/alecthomas/gometalinter/blob/c89a599c3cf15a0034810515d6f922f64df2b6cd/execute.go#L268

        if state.exclude != nil && state.exclude.MatchString(issue.String()) {
            continue
        }
        if state.include != nil && !state.include.MatchString(issue.String()) {
            continue
        }

What kind of behavior is correct in this case?

Thanks a great production.

dnephin commented 6 years ago

To skip vendor use --vendor which will save time before linters wont run on all the directories in vendor.

junpayment commented 6 years ago

@dnephin Thanks a lot! But I wondered if --vendor sounds to contains vendor directories to analysis.