sam init --runtime go1.x produces project Makefile that does not work
See original GitHub issueI was unable to find this reported already
Description
sam init --runtime=go1.x produces a make file file that does not work right out the gate which is a poor situation for developers trying to learn
Steps to reproduce
sam init --name gomakefilebug --runtime go1.x --app-template hello-world
cd gomakefilebug
make
Observed result
Orion:~ tbruno$ sam init --name gomakefilebug --runtime go1.x --app-template hello-world
Cloning app templates from https://github.com/awslabs/aws-sam-cli-app-templates.git
-----------------------
Generating application:
-----------------------
Name: gomakefilebug
Runtime: go1.x
Dependency Manager: mod
Application Template: hello-world
Output Directory: .
Next steps can be found in the README file at ./gomakefilebug/README.md
Orion:~ tbruno$ cd gomakefilebug/
Orion:gomakefilebug tbruno$ make
go get -u ./...
package _/Users/tbruno/gomakefilebug/hello-world: unrecognized import path "_/Users/tbruno/gomakefilebug/hello-world" (import path does not begin with hostname)
make: *** [deps] Error 1
Orion:gomakefilebug tbruno$
Expected result
I would expect this to compile and be able to follow the documentation guides.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: OSX 10.14.5
sam --version
: SAM CLI, version 0.43.0- Go 1.13.8
I believe this issue is caused because the go.mod is in the hello-world directory instead of the project’s root.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
sam init --runtime go1.x produces project Makefile that does ...
I was unable to find this reported already Description sam init --runtime=go1.x produces a make file file that does not work right out...
Read more >Building custom runtimes - AWS Serverless Application Model
Your makefile is responsible for compiling the custom runtime if necessary, and copying the build artifacts into the proper location required for subsequent ......
Read more >GLIBC not found with AWS SAM and Golang - Matt Gaunt
A small AWS SAM project stopped working due to my OS updating to a newer dependency version that SAM couldn't use. The error...
Read more >Highest scored 'aws-sam' questions - Page 7 - Stack Overflow
While running aws sam application locally returns "Internal server error". I created aws sam hello-world example using: sam init --runtime go1.x --name ...
Read more >Develop Lambdas And Debug Them Locally Using SAM
In this article, we will be creating a few simple lambdas and trying them out using SAM, we will also try debugging a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@tebruno99 It is undocumented but is used by the AWS Toolkits to produce debug artifacts for Dotnetcore and for Go once they support it.
SAM_BUILD_MODE=debug sam build
should do it.Relevant code: https://github.com/awslabs/aws-sam-cli/blob/b2c8d991d6876a8236ba3baaa13305befde86d43/samcli/commands/build/command.py#L115 https://github.com/awslabs/aws-lambda-builders/blob/develop/aws_lambda_builders/workflows/go_modules/builder.py#L50
Thanks for the pointer @jfuss I’ll see what I can do