aws / aws-toolkit-jetbrains

AWS Toolkit for JetBrains - a plugin for interacting with AWS from JetBrains IDEs
https://plugins.jetbrains.com/plugin/11349-aws-toolkit
Apache License 2.0
754 stars 221 forks source link

Got "Error: GoModulesBuilder:Resolver" when I want to create a Lambda function by GoLand #3118

Open BradfordSun opened 2 years ago

BradfordSun commented 2 years ago

Question

When I want to create a Lambda function by GoLand, it shows some error in the Build tab:

"C:\Program Files\Amazon\AWSSAMCLI\bin\sam.cmd" build --template C:\Users\0145\AppData\Local\Temp\temp-template4096796463320167285.yaml --build-dir C:\Users\0145\GolandProjects\Lambda\.aws-sam\build
Building codeuri: C:\Users\0145\GolandProjects\Lambda runtime: go1.x metadata: {} architecture: x86_64 functions: ['Function']

Build Failed
Error: GoModulesBuilder:Resolver - Path resolution for runtime: go1.x of binary: go was not successful
SAM Build has failed: Command did not exit successfully, exit code: 1
goland has failed: Command did not exit successfully, exit code: 1

And here is my project structure: image

Here is my simple main.go file from AWS documentation:

package main

import (
    "context"
    "fmt"
    "github.com/aws/aws-lambda-go/lambda"
)

type MyEvent struct {
    Name string `json:"name"`
}

func HandleRequest(ctx context.Context, name MyEvent) (string, error) {
    return fmt.Sprintf("Hello %s!", name.Name), nil
}

func main() {
    lambda.Start(HandleRequest)
}

Here is my settings when I created Lambda: image

May I ask why I got the error and is there any tutorial for AWS Lambda with GoLand?

Thank you in advance.

rli commented 2 years ago

related: #3063