Navigation Menu

Skip to content
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

fix: comma in exclude pattern leads to unexpected results #1917

Merged
merged 2 commits into from Apr 19, 2021

Conversation

ldez
Copy link
Member

@ldez ldez commented Apr 19, 2021

Fixes #665

to check the PR:

main.go
package main

import (
	"fmt"
)

func main() {
	foo := "get"
	bar := "get"
	more := "get"
	again := "get"

	fmt.Println(foo+bar+more, again)

	goo()
}

func goo() {
	foo := "example"
	bar := "example"
	more := "example"
	again := "example"

	fmt.Println(foo+bar+more, again)
}
.golangci.yml
linters:
  disable-all: true
  enable:
    - goconst

issues:
  exclude:
    - string .get. has \d+ occurrences, make it a constant

before the PR:

$ golangci-lint run

after the PR:

$ ./golangci-lint run
main.go:19:9: string `example` has 4 occurrences, make it a constant (goconst)
        foo := "example"
               ^

@ldez ldez added the bug Something isn't working label Apr 19, 2021
pkg/commands/run.go Outdated Show resolved Hide resolved
Copy link
Member

@bombsimon bombsimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ldez ldez merged commit 9cb902c into golangci:master Apr 19, 2021
@ldez ldez deleted the fix/exclude-text-comma branch April 19, 2021 13:20
@ldez ldez added this to the v1.40 milestone Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Comma in exclude pattern leads to unexpected results
2 participants