Skip to content

Commit e335171

Browse files
sriram-mvjfuss
authored andcommitted
fix: go validator (#93)
* fix: go validator * fix: remove pin on golang
1 parent 95327c3 commit e335171

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ install:
3030

3131
# setup go
3232
- rmdir c:\go /s /q
33-
- "choco install golang --version 1.11.5"
33+
- "choco install golang"
3434
- "choco install bzr"
3535
- "choco install dep"
3636
- setx PATH "C:\go\bin;C:\gopath\bin;C:\Program Files (x86)\Bazaar\;C:\Program Files\Mercurial;%PATH%;"

aws_lambda_builders/workflows/go_modules/validator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def validate(self, runtime_path):
5353
out_parts = out.decode().split()
5454
if len(out_parts) >= 3:
5555
version_parts = [int(x) for x in out_parts[2].replace(self.LANGUAGE, "").split('.')]
56-
if len(version_parts) == 3:
56+
if len(version_parts) >= 2:
5757
if version_parts[0] == expected_major_version and version_parts[1] >= min_expected_minor_version:
5858
self._valid_runtime_path = runtime_path
5959
return self._valid_runtime_path

tests/unit/workflows/go_modules/test_validator.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ def test_runtime_validate_supported_version_runtime(self):
4040
self.validator.validate(runtime_path="/usr/bin/go")
4141
self.assertTrue(mock_subprocess.call_count, 1)
4242

43+
def test_runtime_validate_supported_higher_than_min_version_runtime(self):
44+
with mock.patch("subprocess.Popen") as mock_subprocess:
45+
mock_subprocess.return_value = MockSubProcess(0, out=b"go version go1.12 test")
46+
self.validator.validate(runtime_path="/usr/bin/go")
47+
self.assertTrue(mock_subprocess.call_count, 1)
48+
4349
def test_runtime_validate_mismatch_nonzero_exit(self):
4450
with mock.patch("subprocess.Popen") as mock_subprocess:
4551
mock_subprocess.return_value = MockSubProcess(1)

0 commit comments

Comments
 (0)