aws / aws/aws-lambda-go

NewHandler should return input if it is of type Handler

Open
#270 4 comments 0 reactions 0 assignees View on GitHub
documentation enhancement
Dominant language
Go
Stars
3.8k
Forks
578
Avg merge
8h 18m
Merged PRs (30d)
1

Description

**Is your feature request related to a problem? Please describe.**
Just had an issue where we accidentally did something like this:
```go
h := lambda.NewHandler(...)
lambda.Start(h)
```
instead of this:
```go
h := lambda.NewHandler(...)
lambda.StartHandler(h)
```

This is caused by the fact that `Start` takes `interface{}`, so the compiler is unable to detect the error.

**Describe the solution you'd like**
`NewHandler` should check if the input implements `Handler` and if so return the input unchanged, possibly logging some kind of warning.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.