1

I have several protobuf structs that were generated to golang code. Inside structs I have imported generated fields:

type GeneratedStruct struct {
    state         protoimpl.MessageState
    sizeCache     protoimpl.SizeCache
    unknownFields protoimpl.UnknownFields
    ...
}

I'm using golangci-lint version 1.32.2 This linter contains exhaustivestruct linter that I want to use (I dont want to exclude it).

I tried to do something like this in .golangci.yaml file:

linters-settings:
  exhaustive:
    check-generated: false
  exhaustivestruct:
    check-generated: false

But this linter is still returning errors on generated structs.

Is there a way to disable this linter on such generated structs?

BTW, I know about //nolint: ... but it is a little nerving to write it all over the code.

Thank you.

RedCollarPanda
  • 1,389
  • 1
  • 20
  • 40
  • 2
    You can use `skip-files` to provide a regex to match paths you want to exclude, or `skip-dirs` to list directories to exclude. You can also use `ignore` and `exclude` to exclude files from specific linters. https://golangci-lint.run/usage/configuration/#config-file – Adrian Nov 23 '20 at 15:51
  • that is not the case - I need checking of files, but don't want checks for several generated structs – RedCollarPanda Nov 23 '20 at 17:01
  • 1
    Those are the available options for that particular linter. – Adrian Nov 23 '20 at 18:49

0 Answers0