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

Error fetching aws lambda go library #2510

Closed
classifieds-dev opened this issue May 19, 2020 · 3 comments
Closed

Error fetching aws lambda go library #2510

classifieds-dev opened this issue May 19, 2020 · 3 comments

Comments

@classifieds-dev
Copy link

classifieds-dev commented May 19, 2020

What version of rules_go are you using?

v0.19.5

What version of gazelle are you using?

0.18.2

What version of Bazel are you using?

Build label: 3.1.0
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Wed Apr 22 10:35:52 2020 (1587551752)
Build timestamp: 1587551752
Build timestamp as int: 1587551752

Does this issue reproduce with the latest releases of all the above?

Not sure

What operating system and processor architecture are you using?

Mac High Sierra 10.13.6

Any other potentially useful information about your toolchain?

n/a - see minimal reproduction

Issue is also occurring for the following package: github.com/awslabs/aws-lambda-go-api-proxy
However, that package has been omitted in the reproduction. Might help diagnose the issue.

What did you do?

Example Repo

https://github.com/classifieds-dev/lamba-bazel-example

Run command:

bazel fetch //apps/api1

What did you expect to see?

dependencies resolved

What did you see instead?

ERROR: /Users/foo/Projects/lambda-bazel-example/apps/api1/BUILD:2:1: no such package '@com_github_aws_aws_lambda_go//': BUILD file not found in directory '' of external repository @com_github_aws_aws_lambda_go. Add a BUILD file to a directory to mark it as a package. and referenced by '//apps/api1:api1'
ERROR: /Users/foo/Projects/lambda-bazel-example/apps/api1/BUILD:2:1: no such package '@com_github_aws_aws_lambda_go//': BUILD file not found in directory '' of external repository @com_github_aws_aws_lambda_go. Add a BUILD file to a directory to mark it as a package. and referenced by '//apps/api1:api1'
ERROR: Evaluation of query "deps(//apps/api1)" failed: errors were encountered while computing transitive closure
Loading: 1 packages loaded

@classifieds-dev
Copy link
Author

I discovered this post

#2262

Which lead me to discovering solution (I think).

bazel run //:gazelle

Which altered some of my build files that I had copy and pasted from a tutorial.

This also provided an error message that finally made some sense.

go prefix is not set, so importpath can't be determined for rules. Set a prefix with a '# gazelle:prefix' comment or with -go_prefix on the command line

So I set the prefix in the root build file and was finally able to build successfully.

@jayconrod
Copy link
Contributor

Looks like this is working now, so I'll close this.

The previous commit had a dependency on @com_github_aws_aws_lambda_go//:go_default_library. That corresponds to the import path github.com/aws/aws-lambda-go. There's no package there, so no build file was generated. Running Gazelle changes the label to @com_github_aws_aws_lambda_go//lambda:go_default_library.

@classifieds-dev
Copy link
Author

I see that. Thanks for responding so quickly. I'm new to go but have used many other languages over the years. So its going to be a bit of a learning curve. However, its difficult to ignore the low memory consumption, execution and cold start speed of go lambda. So I think its worth it.

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

No branches or pull requests

2 participants