awslabs / aws-lambda-go-api-proxy

lambda-go-api-proxy makes it easy to port APIs written with Go frameworks such as Gin (https://gin-gonic.github.io/gin/ ) to AWS Lambda and Amazon API Gateway.
Apache License 2.0
1.05k stars 197 forks source link

Add support for echo #35

Closed watermelo closed 5 years ago

jackwellsxyz commented 5 years ago

Hi @watermelo any chance you could also support a v4 echo router as well? I'm trying to use it with deepmap/oapi-codegen and the code it generates uses "github.com/labstack/echo/v4", which conflicts with the echo adapter types you're using.

sam3d commented 5 years ago

@jackwellsxyz Add this line in your go.mod:

replace github.com/labstack/echo => github.com/labstack/echo/v4 v4.1.6

It will transparently change all references to github.com/labstack/echo to the v4 in your own code, as well in any dependencies (including the echoadapter). This feels like the cleanest way for the moment, as I personally don't like the v4 syntax in my own files either.


Previous solution:

I found the contents of the echo/adapter.go to be small enough that I just copied and pasted the code into my own internal package and then just updated the import to use v4. It still functions the same, except with the new types.

It's an unfortunate thing to have to do, but it's completely functional for now.