Skip to content

Commit

Permalink
prevent unused time import in event streams
Browse files Browse the repository at this point in the history
  • Loading branch information
lucix-aws committed Jul 19, 2023
1 parent e4acaad commit 37fd361
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
### SDK Enhancements

### SDK Bugs
* `codegen`: Prevent unused imports from being generated for event streams.
* Potentially-unused `"time"` import was causing vet failures on generated code.
2 changes: 2 additions & 0 deletions private/model/api/codegentest/service/restjsonservice/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions private/model/api/codegentest/service/restxmlservice/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions private/model/api/codegentest/service/rpcservice/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions private/model/api/eventstream_tmpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ func renderEventStreamAPI(w io.Writer, op *Operation) error {
op.API.AddSDKImport("private/protocol/eventstream")
op.API.AddSDKImport("private/protocol/eventstream/eventstreamapi")

// usages of these imports are conditional - generate a compile-only
// reference to avoid potential unused imports:
// - awserr is only used for input streams or json protocols
// - time is only used for input streams or if an event payload has a
// timestamp field
w.Write([]byte(`
var _ awserr.Error
var _ time.Time
`))

return eventStreamAPITmpl.Execute(w, op)
Expand Down
1 change: 1 addition & 0 deletions service/kinesis/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions service/lambda/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions service/lexruntimev2/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions service/s3/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions service/transcribestreamingservice/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 37fd361

Please sign in to comment.