mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Merge pull request #924 from ashanbrown/unset-gobin
Ensure that GOBIN is unset when installing a golang hook
This commit is contained in:
commit
160238220f
2 changed files with 9 additions and 0 deletions
|
|
@ -69,6 +69,7 @@ def install_environment(prefix, version, additional_dependencies):
|
|||
else:
|
||||
gopath = directory
|
||||
env = dict(os.environ, GOPATH=gopath)
|
||||
env.pop('GOBIN', None)
|
||||
cmd_output('go', 'get', './...', cwd=repo_src_dir, env=env)
|
||||
for dependency in additional_dependencies:
|
||||
cmd_output('go', 'get', dependency, cwd=repo_src_dir, env=env)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ from pre_commit import five
|
|||
from pre_commit import parse_shebang
|
||||
from pre_commit.clientlib import CONFIG_SCHEMA
|
||||
from pre_commit.clientlib import load_manifest
|
||||
from pre_commit.envcontext import envcontext
|
||||
from pre_commit.languages import golang
|
||||
from pre_commit.languages import helpers
|
||||
from pre_commit.languages import node
|
||||
|
|
@ -267,6 +268,13 @@ def test_golang_hook(tempdir_factory, store):
|
|||
)
|
||||
|
||||
|
||||
def test_golang_hook_still_works_when_gobin_is_set(tempdir_factory, store):
|
||||
gobin_dir = tempdir_factory.get()
|
||||
with envcontext([('GOBIN', gobin_dir)]):
|
||||
test_golang_hook(tempdir_factory, store)
|
||||
assert os.listdir(gobin_dir) == []
|
||||
|
||||
|
||||
def test_rust_hook(tempdir_factory, store):
|
||||
_test_hook_repo(
|
||||
tempdir_factory, store, 'rust_hooks_repo',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue