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

Supporting golang submodules #2565

Closed
arjenjb opened this issue Oct 28, 2022 · 2 comments
Closed

Supporting golang submodules #2565

arjenjb opened this issue Oct 28, 2022 · 2 comments

Comments

@arjenjb
Copy link

arjenjb commented Oct 28, 2022

I opened PR #2561 and you closed it due to not wanting to guess the path to the go module which I agree with. It was a naive approach.

I understand your concern. However, could we try and work towards a solution? It would be really helpful if pre-commit could support this scenario. Otherwise precommit cannot support any go library that has a major version higher than v1. A solution from my end would be forking the Go module repo, rewrite it so all is in the root. But you can imagine this is very cumbersome.

An approach: If we would have information about the revision of the hook repository in the install_environment step we can extract the proper major version and exactly determine the location of go.mod.

Proof of concept here:
arjenjb/pre-commit@main...feature/pass-rev-to-install-env

Thoughts?

@asottile
Copy link
Member

pre-commit always installs from the root of the repository

the subdirs thing doesn't need to happen that way, you can just as easily put the v2 into the repository name

the convention from go's side is a hack for lack of a real package manager

@arjenjb
Copy link
Author

arjenjb commented Oct 28, 2022

the subdirs thing doesn't need to happen that way, you can just as easily put the v2 into the repository name

yeah, but it does and golang'ers do it this way

but I'm hearing an unwillingness to do anything about it from your side so I'll drop the issue. We'll have a look then at another pre-commit like solution

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

No branches or pull requests

2 participants