Skip to content

build-tags shouldn't have to be allowed manually one by one #517

Closed
@lopezator

Description

@lopezator

Current behavior:

If you have any file with a build tag, e.g. // +build integration or others, files under that tag won't be checked unless you explicitly pass them manually by using:

run:
  build-tags:
    - integration

Or the corresponding --build-tagsflag.

I've been using golangci-lint for the past few months and didn't noticed this behavior until now. I have a lot of tests against a DB marked as // +build integration and thus, weren't being checked by golangci-lint.

In addition I think it's easy to forget to modify golangci-lint config everytime you add a new tag to your code, resulting in a lot of bad formatted, unchecked files.

Proposal:

Using https://golang.org/pkg/go/parser/ or some other tool (I would have to investigate further), to discover all the build tags present on the project, extracting a list.

The proposed golangci-lint behaviour would enable by default all build tags (or at least have a new enable-all property for backwards compatibility purposes), being able to disable individual checks as you wish.

This way, you can keep a sane synced config even if you modify your code or add new tags to it without having to modify golangci-lint config every time.

What do you think @jirfag ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: configRelated to .golangci.yml and/or cli optionsenhancementNew feature or improvementstaleNo recent correspondence or work activity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions