CDK Go package includes

0

Folks, given the following seemingly normal project setup, cdk-deploy all fails, it is unable to locate the files.

./our_company.go:

package main
func main() {
   SomeStack(app, "SomeStack", &StackProps{})
}

./somestack.go:

package main
func SomeStack(scope constructs.Construct, id string, props *StackProps) awscdk.Stack {}

No issues in Goland, its a simple main package with functions spread across files.

cdk fails:

$ cdk deploy -all
./our_company.go:1262:2: undefined: SomeStack
V
asked 3 months ago101 views
1 Answer
1
  • Ensure both our_company.go and somestack.go are in the same directory.
  • Running go build might provide additional context or a more detailed error message, helping you understand why the CDK thinks SomeStack is undefined. When you run the go build or go run commands, make sure to include all relevant files. For example:
go build our_company.go somestack.go
go run .

If this has answered your question or was helpful, accepting the answer would be greatly appreciated. Thank you!

profile picture
EXPERT
answered 3 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions