Skip to content

Commit

Permalink
Remove guess_go_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
taoufik07 committed Dec 29, 2022
1 parent cbead26 commit d251ed6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 33 deletions.
16 changes: 0 additions & 16 deletions pre_commit/languages/golang.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,6 @@ def in_env(
yield


def guess_go_dir(remote_url: str) -> str:
if remote_url.endswith('.git'):
remote_url = remote_url[:-1 * len('.git')]
looks_like_url = (
not remote_url.startswith('file://') and
('//' in remote_url or '@' in remote_url)
)
remote_url = remote_url.replace(':', '/')
if looks_like_url:
_, _, remote_url = remote_url.rpartition('//')
_, _, remote_url = remote_url.rpartition('@')
return remote_url
else:
return 'unknown_src_dir'


def install_environment(
prefix: Prefix, version: str, additional_dependencies: Sequence[str],
) -> None:
Expand Down
17 changes: 0 additions & 17 deletions tests/languages/golang_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,3 @@ def test_golang_default_version_system_available(helpers_exe_exists_mck):
def test_golang_default_version_system_not_available(helpers_exe_exists_mck):
helpers_exe_exists_mck.return_value = False
assert ACTUAL_GET_DEFAULT_VERSION() == '1.19.4'


@pytest.mark.parametrize(
('url', 'expected'),
(
('/im/a/path/on/disk', 'unknown_src_dir'),
('file:///im/a/path/on/disk', 'unknown_src_dir'),
('git@github.com:golang/lint', 'github.com/golang/lint'),
('git://github.com/golang/lint', 'github.com/golang/lint'),
('http://github.com/golang/lint', 'github.com/golang/lint'),
('https://github.com/golang/lint', 'github.com/golang/lint'),
('ssh://git@github.com/golang/lint', 'github.com/golang/lint'),
('git@github.com:golang/lint.git', 'github.com/golang/lint'),
),
)
def test_guess_go_dir(url, expected):
assert golang.guess_go_dir(url) == expected

0 comments on commit d251ed6

Please sign in to comment.