aws / aws/aws-cdk

cdk go template files break go commands

Open
#23,222 4 comments 0 reactions 0 assignees View on GitHub
bug effort/small p2 package/tools
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

It's hard to use the CDK as a deployment tool in go projects because the node_modules/ directory contains go files with invalid names:
node_modules/aws-cdk/lib/init-templates/app/go: invalid input file name "%name%.template.go"
node_modules/aws-cdk/lib/init-templates/sample-app/go: invalid input file name "%name%.template.go"

These look like template files, so in don't think the names are important. If they had some extension other than '.go', they wouldn't interfere with go fmt, lint, test, etc.

### Expected Behavior

go test -v ./... -tags unit
? github.com/gg-cloud/lambda-bootstrap-rds [no test files]
=== RUN TestGetLogger
=== RUN TestGetLogger/sdf
{"level":"info","version":"my_version","message":"my_message"}
--- PASS: TestGetLogger (0.00s)
--- PASS: TestGetLogger/sdf (0.00s)
PASS
ok github.com/gg-cloud/lambda-bootstrap-rds/log (cached)
=== RUN TestGetDbConnection
=== RUN TestGetDbConnection/local-docker:valid_postgres_db
--- PASS: TestGetDbConnection (0.00s)
--- PASS: TestGetDbConnection/local-docker:valid_postgres_db (0.00s)
PASS
ok github.com/gg-cloud/lambda-bootstrap-rds/sql (cached)

### Current Behavior

make unittest
package github.com/gg-cloud/lambda-bootstrap-rds/node_modules/aws-cdk/lib/init-templates/app/go: invalid input file name "%name%.template.go"
package github.com/gg-cloud/lambda-bootstrap-rds/node_modules/aws-cdk/lib/init-templates/sample-app/go: invalid input file name "%name%.template.go"
go test -v -tags unit
? github.com/gg-cloud/lambda-bootstrap-rds [no test files]

### Reproduction Steps

gofmt -w -s .

### Possible Solution

rename those files from *.go to *.gotemplate

### Additional Information/Context

_No response_

### CDK CLI Version

2.52.0

### Framework Version

2.52.0

### Node.js Version

16

### OS

linux

### Language

Python

### Language Version

3.10

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Inspect node_modules/aws-cdk/lib/init-templates/app/go and node_modules/aws-cdk/lib/init-templates/sample-app/go, focusing on the files named %name%.template.go. Run gofmt -w . or make unittest to reproduce the invalid input filename, then verify that go test -v ./... -tags unit completes without errors after the template filenames no longer match Go source files.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, node.js
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.