Skip to content

(aws-cdk): go template breaks go list #648

Closed as not planned
Closed as not planned
@mguterl

Description

@mguterl

aws/aws-cdk#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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions