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
Add support for Go 1.16 #1815
Comments
hmmm what an annoying change, why would they do this -- the patch seems unrelated to the issue it closes |
this is the minimal patch to fix $ git diff
diff --git a/pre_commit/resources/empty_template_go.mod b/pre_commit/resources/empty_template_go.mod
index e69de29..fc0ab8c 100644
--- a/pre_commit/resources/empty_template_go.mod
+++ b/pre_commit/resources/empty_template_go.mod
@@ -0,0 +1,3 @@
+go 1.11
+
+module pre-commit-dummy-empty-module the testsuite however uses classical gopath-based modules which apparently are outright broken by go 1.16 unless |
In addition, adding the file I can make a PR if you want. |
sure! it seems surprising that such a I wonder if there's something with our temporary but yeah feel free to send a PR to get the ball rolling! |
hmm yeah it might just be that we need to copy the repo remote along here: pre-commit/pre_commit/languages/golang.py Lines 72 to 73 in f3de91c
|
Go 1.16 now rejects empty
go.mod
files (c.f. golang/go@d4986e0). This means thatgolang
hooks cannot be installed anymore:I could get it to work by changing
pre_commit/resources/empty_template_go.mod
from an empty file to:But I'm not all that familiar with how modules work in different Go versions, so maybe making that change has some other implications that I don't know about. This Go Wiki entry seems to suggest that empty
go.mod
files are legal, but maybe it's outdated... (c.f: #1428 (review))The fix is compatible with Go 1.15.
I tried validating the fix by running the test suite (
pytest tests -k golang
), but I can't get it to pass with Go 1.15 and currentmaster
branch either.The text was updated successfully, but these errors were encountered: