(aws-cdk): go template breaks go list
See original GitHub issue#13840 added an app template for go and the filenames break go list ./...
when cdk project is embedded inside of a Go project.
Reproduction Steps
mkdir project
cd project
cdk init app --language=typescript
go mod init github.com/test/project
echo "package main\nfunc main() { return }\n" > main.go
go list ./... # fails because of template files
package github.com/test/project/node_modules/aws-cdk/lib/init-templates/v1/app/go: invalid input file name "%name%.template.go"
What did you expect to happen?
I expected go list ./...
to return a list of package names.
What actually happened?
List of package name was not returned and an error was returned instead.
package github.com/test/project/node_modules/aws-cdk/lib/init-templates/v1/app/go: invalid input file name "%name%.template.go"
Environment
- CDK CLI Version: 1.96.0 (build 39f3df8)
- Framework Version: ?
- Node.js Version: v15.13.0
- OS : macOS 11.2.3
- Language (Version): all
- Go (Version): 1.16.3
Other
I think it might be possible to add an empty go.mod
file into the template directory to prevent this from happening, but I’m hardly an expert in Go.
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 2 years ago
- Reactions:16
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Working with the AWS CDK in Go
cdk synth : Synthesizes a AWS CloudFormation template from one or more of the stacks in your AWS CDK app. cdk deploy :...
Read more >AWS CDK with Golang - poweruser.blog
Like sourcing from example cloudformation templates found on GitHub. Or another one would be using the AWS WebUI to provision infrastructure by ...
Read more >Go project containing Typescript AWS-CDK directory has ...
npx cdk init app --language typescript cd .. mkdir src cd src go mod init example go mod tidy cd .. This creates...
Read more >Go - Noise
The AWS CDK mounts the folder specified as the first argument to fromAsset at /asset-input inside the container, and mounts the asset output...
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 FreeTop 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
Top GitHub Comments
Here’s my dirty quickfix for now:
(We don’t need those templates in already initialized projects anyway.)
Since this is still a problem and there’s now a v2 template for Go, I had to update my workaround a bit: