|
16 | 16 | from pre_commit.clientlib.validate_config import CONFIG_JSON_SCHEMA |
17 | 17 | from pre_commit.clientlib.validate_config import validate_config_extra |
18 | 18 | from pre_commit.jsonschema_extensions import apply_defaults |
| 19 | +from pre_commit.languages import golang |
19 | 20 | from pre_commit.languages import helpers |
20 | 21 | from pre_commit.languages import node |
21 | 22 | from pre_commit.languages import pcre |
@@ -542,6 +543,25 @@ def test_additional_node_dependencies_installed( |
542 | 543 | assert 'lodash' in output |
543 | 544 |
|
544 | 545 |
|
| 546 | +@pytest.mark.integration |
| 547 | +def test_additional_golang_dependencies_installed( |
| 548 | + tempdir_factory, store, |
| 549 | +): |
| 550 | + path = make_repo(tempdir_factory, 'golang_hooks_repo') |
| 551 | + config = make_config_from_repo(path) |
| 552 | + # A small go package |
| 553 | + deps = ['github.com/golang/example/hello'] |
| 554 | + config['hooks'][0]['additional_dependencies'] = deps |
| 555 | + repo = Repository.create(config, store) |
| 556 | + repo.require_installed() |
| 557 | + binaries = os.listdir(repo.cmd_runner.path( |
| 558 | + helpers.environment_dir(golang.ENVIRONMENT_DIR, 'default'), 'bin', |
| 559 | + )) |
| 560 | + # normalize for windows |
| 561 | + binaries = [os.path.splitext(binary)[0] for binary in binaries] |
| 562 | + assert 'hello' in binaries |
| 563 | + |
| 564 | + |
545 | 565 | def test_reinstall(tempdir_factory, store, log_info_mock): |
546 | 566 | path = make_repo(tempdir_factory, 'python_hooks_repo') |
547 | 567 | config = make_config_from_repo(path) |
|
0 commit comments