Skip to content

Conversation

magnetikonline
Copy link
Contributor

@magnetikonline magnetikonline commented Nov 9, 2023

Quick one that tripped me up recently.

With the exhaustruct linter - the list of structs to include/exclude must match the full package/name/structname - otherwise no match will be made/considered.

E.g. if I wish to target a struct of:

github.com/this/is/my/package/CoolStruct

These will work:

github\.com/this/is/my/package/CoolStruct
github\.com/this/is/my/package/Cool.+

This won't work:

github\.com/this/is/my/package/Cool
^github\.com/this/is/my/package/Cool

The source for exhauststruct helps explain this behaviour: https://github.com/GaijinEntertainment/go-exhaustruct/blob/917096e5c081c98cd2bba5ecac3d3fa1479a6029/internal/pattern/list.go#L39-L47

Hopefully this comment helps in that usage!

@ldez ldez changed the title Note that exhaustruct struct regular expressions are expected to match the entire package/name/structname docs: note that exhaustruct struct regular expressions are expected to match the entire package/name/structname Nov 9, 2023
@ldez ldez added the enhancement New feature or improvement label Nov 9, 2023
@ldez ldez merged commit 467d563 into golangci:master Nov 9, 2023
@ldez ldez modified the milestone: v1.56 Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docs enhancement New feature or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants