question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sam init --runtime go1.x produces project Makefile that does not work

See original GitHub issue

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 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)

  1. OS: OSX 10.14.5
  2. sam --version: SAM CLI, version 0.43.0
  3. 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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
jfusscommented, Feb 26, 2020

@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

1reaction
JoelPagliucacommented, Mar 23, 2020

Thanks for the pointer @jfuss I’ll see what I can do

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found