Skip to content

Workaround for #33 - go sub-modules #34

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

Merged
merged 3 commits into from
Jan 24, 2020
Merged

Conversation

alexellis
Copy link
Member

@alexellis alexellis commented Jan 24, 2020

Workaround for #33 - go sub-modules

Fixes: #33

Go sub-modules do not work with this template, because the of
limitations on how local imports and the "replace" word works
in Go modules. You can only use "replace" in the root-level module
i.e. "main.go"

https://github.com/golang/go/wiki/Modules#gomod

This patch was tested with the following repo:

[email protected]:alexellis/golang-middleware-relative-import.git

Signed-off-by: Alex Ellis (OpenFaaS Ltd) [email protected]

@alexellis alexellis force-pushed the openfaasltd/sub-modules branch from bebfc6f to b42517f Compare January 24, 2020 11:07
Fixes: #33

Go sub-modules do not work with this template, because the of
limitations on how local imports and the "replace" word works
in Go modules. You can only use "replace" in the root-level module
i.e. "main.go"

https://github.com/golang/go/wiki/Modules#gomod

This patch was tested with the following repo:

[email protected]:alexellis/golang-middleware-relative-import.git

* Documentation in the README has been updated
* Tested e2e and with a local "go test" in GOPATH with modules
turned on and Go 1.13
* Updated copy commands in Dockerfile so that they use a faster
mechanism, vs creating a new container step to chown (must be
tested with buildkit before merging, since buildkit did not like
this approach in the past when running as a restricted user at
runtime)

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
Copy link

@Waterdrips Waterdrips left a comment

Choose a reason for hiding this comment

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

The approach looks workable

@alexellis
Copy link
Member Author

Lgtm from Lucas on Slack. We'll treat this as experimental, unsupported for the time being and gauge interest

@alexellis alexellis merged commit 23db8b3 into master Jan 24, 2020
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.

Go modules - unable to get a sub-package to work
2 participants