-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(aws-cdk): go template breaks go list #13971
Comments
we will investigate if there is an easy fix from our side. I don't know if generally this is a use case that we want to think about compatibility with. The user can put their cdk app anywhere, and node_modules can have a lot of stuff in it. Thinking about what unrelated commands that users can invoke that may conflict with any of the files within node_modules feels hard. In this case though if adding an empty go.mod or otherwise solves this seems easy enough. |
The root cause is the filename doesn't conform to the Golang filename standards by being prefixed with a As a side note, I've also hit this exact error while using the |
This is causing us problems too with ci cd tooling and annoying errors in VSCode... If the files were .go_tempate or something that these files would not be recognised this would not be a problem. Should be an easy fix. |
I agree that an easy fix might be to rename the template from Update: Actually, it's not that easy since the templating is generic and used for all languages. |
Here's my dirty quickfix for now: --- package.json
+++ package.json
@@ -8,7 +8,8 @@
"build": "tsc",
"watch": "tsc -w",
"test": "jest",
- "cdk": "cdk"
+ "cdk": "cdk",
+ "postinstall": "rm -rf node_modules/aws-cdk/lib/init-templates/v1/app/go"
}, (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: "postinstall": "rm -rf node_modules/aws-cdk/lib/init-templates/*/app/go" |
Using |
@tenjaa Which npm version do you use? |
#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
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.
Environment
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
The text was updated successfully, but these errors were encountered: