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

Remove CI dependencies from go.mod #70

Closed
wants to merge 1 commit into from
Closed

Remove CI dependencies from go.mod #70

wants to merge 1 commit into from

Conversation

kszafran
Copy link

@kszafran kszafran commented Nov 6, 2021

We still pin library versions, but without polluting go.mod (which also pollutes go.mod files of projects that depend on this library).

@F21
Copy link
Member

F21 commented Nov 6, 2021

Hey @kszafran, thanks for this PR.
Unfortunately, what this does is scatter the pinning of the versions for those tools across many files, opening the possibility for someone to forget to update a version in one of the files and thus introducing an inconsistency. In addition, it also stops us from using the standard go tools such as go get to update those dependencies and prevents developers who are not using docker to install and run the correct version of golangci-lint etc.

I agree that the transitive dependencies are annoying, but as Go currently lacks the concept of development dependencies, the tools.go method is currently the best and commonly used approach to deal with this problem.

@kszafran
Copy link
Author

kszafran commented Nov 6, 2021

Thank you for the response. I was actually not aware that having something like tools.go is a common practice. In our repositories we keep versions in .pre-commit-config.yaml, which works fine for linters. I looked briefly through this thread. I haven't found there any consensus on what is the current best practice, but I found some ideas at least:

I'm just throwing some ideas out there, but it's of course up to you if you prefer to stay with the current approach.

@F21
Copy link
Member

F21 commented Nov 7, 2021

Thanks for looking in to this. With the current state of Go, I still think using tools.go is most idiomatic and easiest to manage. I'll go ahead and close this PR, but hopefully Go will offer a better solution for this use-case in the future.

Even though the transitive dependency is downloaded, it should not be compiled into your final binary if your code does not use any of it.

@F21 F21 closed this Nov 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants