Title: Add support for Go 1.16 · Issue #1815 · pre-commit/pre-commit · GitHub
Open Graph Title: Add support for Go 1.16 · Issue #1815 · pre-commit/pre-commit
X Title: Add support for Go 1.16 · Issue #1815 · pre-commit/pre-commit
Description: Go 1.16 now rejects empty go.mod files (c.f. golang/go@d4986e0). This means that golang hooks cannot be installed anymore: $ pre-commit install-hooks [INFO] Initializing environment for local. [INFO] Installing environment for local. [IN...
Open Graph Description: Go 1.16 now rejects empty go.mod files (c.f. golang/go@d4986e0). This means that golang hooks cannot be installed anymore: $ pre-commit install-hooks [INFO] Initializing environment for local. [INF...
X Description: Go 1.16 now rejects empty go.mod files (c.f. golang/go@d4986e0). This means that golang hooks cannot be installed anymore: $ pre-commit install-hooks [INFO] Initializing environment for local. [INF...
Opengraph URL: https://github.com/pre-commit/pre-commit/issues/1815
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add support for Go 1.16","articleBody":"Go 1.16 now rejects empty `go.mod` files (c.f. https://github.com/golang/go/commit/d4986e0e1d6e03e1b92e905ca5e01b4c223fbeb3). This means that `golang` hooks cannot be installed anymore:\r\n\r\n```\r\n$ pre-commit install-hooks\r\n[INFO] Initializing environment for local.\r\n[INFO] Installing environment for local.\r\n[INFO] Once installed this environment will be reused.\r\n[INFO] This may take a few minutes...\r\nAn unexpected error has occurred: CalledProcessError: command: ('/usr/local/bin/go', 'get', './...')\r\nreturn code: 1\r\nexpected return code: 0\r\nstdout: (none)\r\nstderr:\r\n go: no module declaration in go.mod. To specify the module path:\r\n \tgo mod edit -module=example.com/mod\r\n \r\nCheck the log at /Users/rdraoui/.cache/pre-commit/pre-commit.log\r\n```\r\n\r\n\r\nI could get it to work by changing `pre_commit/resources/empty_template_go.mod` from an empty file to:\r\n\r\n```\r\nmodule example/mod\r\n```\r\n\r\n\r\nBut 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](https://github.com/golang/go/wiki/Modules#can-an-additional-gomod-exclude-unnecessary-content-do-modules-have-the-equivalent-of-a-gitignore-file) seems to suggest that empty `go.mod` files are legal, but maybe it's outdated... (c.f: https://github.com/pre-commit/pre-commit/pull/1428#pullrequestreview-404547009)\r\n\r\nThe fix is compatible with Go 1.15.\r\n\r\nI 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 current `master` branch either.\r\n\r\n","author":{"url":"https://github.com/rafikdraoui","@type":"Person","name":"rafikdraoui"},"datePublished":"2021-02-24T15:49:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/1815/pre-commit/issues/1815"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:878b97af-21ed-f4f9-a495-e449d7834791 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CA44:211953:8A3A07:C908D2:6A549AE5 |
| html-safe-nonce | 070842d11bdfb4c57f0c2b8f22da6b2bf15aa98632ca979eeb0d7e9786f18e7b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQTQ0OjIxMTk1Mzo4QTNBMDc6QzkwOEQyOjZBNTQ5QUU1IiwidmlzaXRvcl9pZCI6IjUxNzUwODEzMDU5MDY2NDk4MjkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d3635d4833798bf3c93700c249ee6c2928c2c53199a05ef843bb1c673234777e |
| hovercard-subject-tag | issue:815604651 |
| github-keyboard-shortcuts | repository,issues,commits,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/pre-commit/pre-commit/1815/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ac43193e2f93209ad4b1e23573753553a33e7fdf13d3d67fd3eb1a6910fd20de/pre-commit/pre-commit/issues/1815 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ac43193e2f93209ad4b1e23573753553a33e7fdf13d3d67fd3eb1a6910fd20de/pre-commit/pre-commit/issues/1815 |
| og:image:alt | Go 1.16 now rejects empty go.mod files (c.f. golang/go@d4986e0). This means that golang hooks cannot be installed anymore: $ pre-commit install-hooks [INFO] Initializing environment for local. [INF... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rafikdraoui |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/pre-commit/pre-commit git https://github.com/pre-commit/pre-commit.git |
| octolytics-dimension-user_id | 6943086 |
| octolytics-dimension-user_login | pre-commit |
| octolytics-dimension-repository_id | 17689377 |
| octolytics-dimension-repository_nwo | pre-commit/pre-commit |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 17689377 |
| octolytics-dimension-repository_network_root_nwo | pre-commit/pre-commit |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f8cfff6384f62259baea531c7f58bc7040f8dd92 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width