Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the Go Modules builder #65

Merged
merged 6 commits into from Jan 25, 2019

Conversation

volkangurel
Copy link
Contributor

Issue #, if available:
#64

Description of changes:
Add a builder for Go that assumes the given go project uses Go Modules, and so
can be built using standard go tooling.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@volkangurel volkangurel force-pushed the feature/go-modules-builder branch 3 times, most recently from a543684 to 62c5048 Compare December 28, 2018 16:17
aws_lambda_builders/workflows/go_modules/DESIGN.md Outdated Show resolved Hide resolved
aws_lambda_builders/workflows/go_modules/workflow.py Outdated Show resolved Hide resolved
aws_lambda_builders/workflows/go_modules/builder.py Outdated Show resolved Hide resolved
aws_lambda_builders/actions.py Outdated Show resolved Hide resolved
aws_lambda_builders/workflows/go_modules/utils.py Outdated Show resolved Hide resolved
aws_lambda_builders/workflows/go_modules/workflow.py Outdated Show resolved Hide resolved
aws_lambda_builders/workflows/go_modules/workflow.py Outdated Show resolved Hide resolved
Add a builder for Go that assumes the given go project uses Go Modules, and so
can be built using standard go tooling.
Update the go models path resolvers and validators to the latest framework
merged in aws#55
Copy link
Contributor

@jfuss jfuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some small feedback/questions around the go validation.


mismatched = p.returncode != 0 \
or len(out.split()) < 3 \
or out.split()[2].replace(self.language, "").split('.')[0] != expected_major_version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the output of go version always be in the form of go version go1.10.3 darwin/amd64?

Go Modules is only available with go 1.11 or greater, should we have that as part of this validation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, great point, I'll add that to the validator.


mismatched = p.returncode != 0 \
or len(out.split()) < 3 \
or out.split()[2].decode().replace(self.language, "").split('.')[0] != expected_major_version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go Module is only supported for go versions greater than 1.11 right? Shouldn't this be checking for that instead of just the major version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep!

out, _ = p.communicate()

mismatched = p.returncode != 0 \
or len(out.split()) < 3 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my mac:

$ go version
go version go1.10.3 darwin/amd64

That will fail this check. What is the importance of this check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where out = "go version go1.10.3 darwin/amd64", the len(out.split()) < 3 expression will return False, but that's expected since this is a chained or expression where any truthy part would set mismatched to True and raise an exception later. I can definitely make this clearer to avoid confusion.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh this was a guard for getting the version out of the go version command. I didn't realize this initially.

@@ -1 +1,2 @@
six~=1.11
whichcraft~=0.5.2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't needed anymore right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep!

@jfuss
Copy link
Contributor

jfuss commented Jan 18, 2019

@volkangurel Are you submitting this on behalf of Coinbase? If so, can you confirm you have approval from the company?

@volkangurel
Copy link
Contributor Author

@jfuss I'm happy to submit it either on behalf of Coinbase or myself. Our company policy is:
"Beyond the constraints of the Employee Handbook, upstream Open Source contributions do not require explicit approval by Coinbase.", so I can confirm I have approval from the company if that's required.

Copy link
Contributor

@jfuss jfuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good. Just a couple really small comments.


@property
def validated_runtime_path(self):
return self._valid_runtime_path if self._valid_runtime_path is not None else None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self._valid_runtime_path defaults to None. This can be simplified to just return self._valid_runtime_path.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please. :)

Copy link
Contributor

@jfuss jfuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WOOT! This is an awesome addition to the library!

@jfuss
Copy link
Contributor

jfuss commented Jan 25, 2019

@volkangurel Please confirm this contribution is under the terms of the Apache 2.0 license. Thanks.

@volkangurel
Copy link
Contributor Author

@jfuss I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jfuss jfuss merged commit f9cfb0d into aws:develop Jan 25, 2019
@volkangurel volkangurel deleted the feature/go-modules-builder branch January 25, 2019 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants