Abirdcfly / dupword

A linter that checks for duplicate words in the source code (usually miswritten)
MIT License
13 stars 5 forks source link

Do not check for duplicate words in text examples #20

Closed mitar closed 1 month ago

mitar commented 1 year ago

I have tests and in those tests I have examples which have an output. This linter complains for example on:

func ExampleUnwrap() {
    base := errors.Base("error")
    withPrefix := errors.WithMessage(base, "prefix")
    fmt.Println(withPrefix)
    fmt.Println(errors.Unwrap(withPrefix))
    // Output:
    // prefix: error
    // error
}

But this is the output of the code, I cannot remove that duplicate "error" string. I think this should be detected automatically and all outputs from examples in tests should not be linted.

Abirdcfly commented 1 month ago

Thanks @matthewhughes934 this issue has fixed by #41