Title: Add dummy go.mod for local "empty" installs by scop · Pull Request #1428 · pre-commit/pre-commit · GitHub
Open Graph Title: Add dummy go.mod for local "empty" installs by scop · Pull Request #1428 · pre-commit/pre-commit
X Title: Add dummy go.mod for local "empty" installs by scop · Pull Request #1428 · pre-commit/pre-commit
Description: Empty local golang installs seem to fail when trying to use go modules in additional_dependencies. Test config: repos: - repo: local hooks: - id: shfmt name: shfmt language: golang additional_dependencies: [mvdan.cc/sh/v3/cmd/shfmt] entry: shfmt args: [-w] types: [shell] - id: misspell name: misspell language: golang additional_dependencies: [github.com/client9/misspell/cmd/misspell] entry: misspell args: [-error] types: [text] misspell is there just to represent something that's not a go module, and to see this change didn't break it (it didn't). With pre-commit 2.3.0 shfmt setup fails for me with golang 1.12, 1.13, and 1.14 with: An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/go', 'get', 'mvdan.cc/sh/v3/cmd/shfmt') return code: 1 expected return code: 0 stdout: (none) stderr: package mvdan.cc/sh/v3/cmd/shfmt: cannot find package "mvdan.cc/sh/v3/cmd/shfmt" in any of: /usr/lib/go-1.14/src/mvdan.cc/sh/v3/cmd/shfmt (from $GOROOT) /home/scop/.cache/pre-commit/repoetpe3oez/golangenv-default/src/mvdan.cc/sh/v3/cmd/shfmt (from $GOPATH) After this change, it works out of the box for me with go 1.13 and 1.14. For 1.12 this isn't enough, it would additionally need GO111MODULE=on in the environment, after that it'd work too. I left it out of this PR because I'm not quite sure if it would cause problems with some "conventional" installs pointed to upstream repos that provide a hook config. For this particular test it would not cause any problems with 1.13 or 1.14 though.
Open Graph Description: Empty local golang installs seem to fail when trying to use go modules in additional_dependencies. Test config: repos: - repo: local hooks: - id: shfmt name: shfmt langu...
X Description: Empty local golang installs seem to fail when trying to use go modules in additional_dependencies. Test config: repos: - repo: local hooks: - id: shfmt name: shfmt langu...
Opengraph URL: https://github.com/pre-commit/pre-commit/pull/1428
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:01f9c1ab-a690-d4af-d50d-759f9c6ebc39 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | DD92:FD8CA:4BAE08:6D67C1:6A55E22E |
| html-safe-nonce | 0d08f448109085310d9cb2ba8c330720830a2cb49fb0e1f87fff3fd743ff1fd6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERDkyOkZEOENBOjRCQUUwODo2RDY3QzE6NkE1NUUyMkUiLCJ2aXNpdG9yX2lkIjoiMzQzODcyMTIwODkwNDE4MDI3MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c902f030fd772900b60191574ee7b1cb62ab0ceeb7b95451d1f4d96e62fe09ea |
| hovercard-subject-tag | pull_request:412483921 |
| github-keyboard-shortcuts | repository,commits,pull-request-list,pull-request-conversation,pull-request-files-changed,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/pre-commit/pre-commit/pull/1428/files |
| twitter:image | https://avatars.githubusercontent.com/u/109152?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/109152?s=400&v=4 |
| og:image:alt | Empty local golang installs seem to fail when trying to use go modules in additional_dependencies. Test config: repos: - repo: local hooks: - id: shfmt name: shfmt langu... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b5665c84831ed9ac4fb79519c16c9c5580ba8092fb8bb6e3e72972ec7197348e |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3725c7f9b2a6e3a27ef57c5aed13428c0f65e045 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width