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
已提問 3 個月前檢視次數 109 次
1 個回答
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
專家
已回答 3 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南