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

support build tags #230

Open
gregwebs opened this issue Sep 7, 2019 · 5 comments
Open

support build tags #230

gregwebs opened this issue Sep 7, 2019 · 5 comments

Comments

@gregwebs
Copy link

gregwebs commented Sep 7, 2019

In order to lint all files, the linter needs to be able to use build tags. It will actually fail to run if all the files in a directory have build tags.

@mgechev
Copy link
Owner

mgechev commented Sep 10, 2019

Thanks for sharing this feature request! I see there's a request in golint as well golang/lint#358.

I'm traveling in the next few weeks; will try to look at the feature after that. I see two ways to approach this:

  1. Implement the functionality in github.com/mgechev/dots
  2. Filter the files that dots returned in revive based on their tag

From what I understand, in both cases the tags should be retrieved from the values of environment variables?

@gregwebs
Copy link
Author

I don't know of any environment variables. golangci-lint has a --build-tags argument, that might be a good point of reference.

@mgechev
Copy link
Owner

mgechev commented Sep 15, 2019

Did some research and it looks like the difference is that golangci-lint uses package.Load which supports build tags, compared to revive that uses golint's resolution algorithm that currently has no build tags support. I remember I did that for compatibility since in some cases golint matches more files compared to package.Load.

In October I'll have time to look at it. So far the ideal solution seems to be extension of dots and introduction of a --build-tags option in revive as you mentioned.

@zimmski
Copy link
Contributor

zimmski commented Apr 7, 2022

@mgechev i just migrated our monorepo from golint to revive (because i couldn't get myself to debug another false-positive for golint, doesn't make sense that we maintain it internally if it is deprecated). We have build tags and test packages implemented over go/loader for golint. I think the only thing that is missing is CGo support but we have that implement with our internal static analysis. I don't know if go/loader is still an option these days but if you want to do a session with me looking through the code give me a ping.

@mgechev
Copy link
Owner

mgechev commented Apr 10, 2022

@chavacava might be a better person to have a look at the code with you. I've been mostly focused on TypeScript nowadays.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants