Skip to content

Commit 66bad40

Browse files
committed
Merge branch 'master' of https://github.com/labstack/echo
2 parents 346bdd2 + 135c511 commit 66bad40

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+3808
-1653
lines changed

.github/workflows/echo.yml

Lines changed: 31 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -19,50 +19,48 @@ on:
1919
- '_fixture/**'
2020
- '.github/**'
2121
- 'codecov.yml'
22+
workflow_dispatch:
2223

2324
jobs:
2425
test:
2526
strategy:
2627
matrix:
2728
os: [ubuntu-latest, macos-latest, windows-latest]
2829
# Each major Go release is supported until there are two newer major releases. https://golang.org/doc/devel/release.html#policy
29-
# Echo tests with last four major releases
30-
go: [1.14, 1.15, 1.16, 1.17]
30+
# Echo tests with last four major releases (unless there are pressing vulnerabilities)
31+
# As we depend on `golang.org/x/` libraries which only support last 2 Go releases we could have situations when
32+
# we derive from last four major releases promise.
33+
go: [1.17, 1.18, 1.19]
3134
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
3235
runs-on: ${{ matrix.os }}
3336
steps:
37+
- name: Checkout Code
38+
uses: actions/checkout@v3
39+
with:
40+
ref: ${{ github.ref }}
41+
3442
- name: Set up Go ${{ matrix.go }}
35-
uses: actions/setup-go@v1
43+
uses: actions/setup-go@v3
3644
with:
3745
go-version: ${{ matrix.go }}
3846

39-
- name: Set GOPATH and PATH
40-
run: |
41-
echo "GOPATH=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV
42-
echo "$(dirname $GITHUB_WORKSPACE)/bin" >> $GITHUB_PATH
43-
shell: bash
47+
- name: Run Tests
48+
run: go test -race --coverprofile=coverage.coverprofile --covermode=atomic ./...
4449

45-
- name: Set build variables
50+
- name: Install dependencies for checks
4651
run: |
47-
echo "GOPROXY=https://proxy.golang.org" >> $GITHUB_ENV
48-
echo "GO111MODULE=on" >> $GITHUB_ENV
52+
go install golang.org/x/lint/golint@latest
53+
go install honnef.co/go/tools/cmd/staticcheck@latest
4954
50-
- name: Checkout Code
51-
uses: actions/checkout@v1
52-
with:
53-
ref: ${{ github.ref }}
54-
55-
- name: Install Dependencies
56-
run: go get -v golang.org/x/lint/golint
55+
- name: Run golint
56+
run: golint -set_exit_status ./...
5757

58-
- name: Run Tests
59-
run: |
60-
golint -set_exit_status ./...
61-
go test -race --coverprofile=coverage.coverprofile --covermode=atomic ./...
58+
- name: Run staticcheck
59+
run: staticcheck ./...
6260

6361
- name: Upload coverage to Codecov
64-
if: success() && matrix.go == 1.17 && matrix.os == 'ubuntu-latest'
65-
uses: codecov/codecov-action@v1
62+
if: success() && matrix.go == 1.19 && matrix.os == 'ubuntu-latest'
63+
uses: codecov/codecov-action@v3
6664
with:
6765
token:
6866
fail_ci_if_error: false
@@ -71,39 +69,28 @@ jobs:
7169
strategy:
7270
matrix:
7371
os: [ubuntu-latest]
74-
go: [1.17]
72+
go: [1.19]
7573
name: Benchmark comparison ${{ matrix.os }} @ Go ${{ matrix.go }}
7674
runs-on: ${{ matrix.os }}
7775
steps:
78-
- name: Set up Go ${{ matrix.go }}
79-
uses: actions/setup-go@v1
80-
with:
81-
go-version: ${{ matrix.go }}
82-
83-
- name: Set GOPATH and PATH
84-
run: |
85-
echo "GOPATH=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV
86-
echo "$(dirname $GITHUB_WORKSPACE)/bin" >> $GITHUB_PATH
87-
shell: bash
88-
89-
- name: Set build variables
90-
run: |
91-
echo "GOPROXY=https://proxy.golang.org" >> $GITHUB_ENV
92-
echo "GO111MODULE=on" >> $GITHUB_ENV
93-
9476
- name: Checkout Code (Previous)
95-
uses: actions/checkout@v2
77+
uses: actions/checkout@v3
9678
with:
9779
ref: ${{ github.base_ref }}
9880
path: previous
9981

10082
- name: Checkout Code (New)
101-
uses: actions/checkout@v2
83+
uses: actions/checkout@v3
10284
with:
10385
path: new
10486

87+
- name: Set up Go ${{ matrix.go }}
88+
uses: actions/setup-go@v3
89+
with:
90+
go-version: ${{ matrix.go }}
91+
10592
- name: Install Dependencies
106-
run: go get -v golang.org/x/perf/cmd/benchstat
93+
run: go install golang.org/x/perf/cmd/benchstat@latest
10794

10895
- name: Run Benchmark (Previous)
10996
run: |

CHANGELOG.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,119 @@
11
# Changelog
22

3+
## v4.10.0 - 2022-xx-xx
4+
5+
**Security**
6+
7+
This minor version bumps minimum Go version to 1.17 (from 1.16) due `golang.org/x/` packages we depend on. There are
8+
several vulnerabilities fixed in these libraries.
9+
10+
Echo still tries to support last 4 Go versions but there are occasions we can not guarantee this promise.
11+
12+
13+
14+
15+
## v4.9.1 - 2022-10-12
16+
17+
**Fixes**
18+
19+
* Fix logger panicing (when template is set to empty) by bumping dependency version [#2295](https://github.com/labstack/echo/issues/2295)
20+
21+
**Enhancements**
22+
23+
* Improve CORS documentation [#2272](https://github.com/labstack/echo/pull/2272)
24+
* Update readme about supported Go versions [#2291](https://github.com/labstack/echo/pull/2291)
25+
* Tests: improve error handling on closing body [#2254](https://github.com/labstack/echo/pull/2254)
26+
* Tests: refactor some of the assertions in tests [#2275](https://github.com/labstack/echo/pull/2275)
27+
* Tests: refactor assertions [#2301](https://github.com/labstack/echo/pull/2301)
28+
29+
## v4.9.0 - 2022-09-04
30+
31+
**Security**
32+
33+
* Fix open redirect vulnerability in handlers serving static directories (e.Static, e.StaticFs, echo.StaticDirectoryHandler) [#2260](https://github.com/labstack/echo/pull/2260)
34+
35+
**Enhancements**
36+
37+
* Allow configuring ErrorHandler in CSRF middleware [#2257](https://github.com/labstack/echo/pull/2257)
38+
* Replace HTTP method constants in tests with stdlib constants [#2247](https://github.com/labstack/echo/pull/2247)
39+
40+
41+
## v4.8.0 - 2022-08-10
42+
43+
**Most notable things**
44+
45+
You can now add any arbitrary HTTP method type as a route [#2237](https://github.com/labstack/echo/pull/2237)
46+
```go
47+
e.Add("COPY", "/*", func(c echo.Context) error
48+
return c.String(http.StatusOK, "OK COPY")
49+
})
50+
```
51+
52+
You can add custom 404 handler for specific paths [#2217](https://github.com/labstack/echo/pull/2217)
53+
```go
54+
e.RouteNotFound("/*", func(c echo.Context) error { return c.NoContent(http.StatusNotFound) })
55+
56+
g := e.Group("/images")
57+
g.RouteNotFound("/*", func(c echo.Context) error { return c.NoContent(http.StatusNotFound) })
58+
```
59+
60+
**Enhancements**
61+
62+
* Add new value binding methods (UnixTimeMilli,TextUnmarshaler,JSONUnmarshaler) to Valuebinder [#2127](https://github.com/labstack/echo/pull/2127)
63+
* Refactor: body_limit middleware unit test [#2145](https://github.com/labstack/echo/pull/2145)
64+
* Refactor: Timeout mw: rework how test waits for timeout. [#2187](https://github.com/labstack/echo/pull/2187)
65+
* BasicAuth middleware returns 500 InternalServerError on invalid base64 strings but should return 400 [#2191](https://github.com/labstack/echo/pull/2191)
66+
* Refactor: duplicated findStaticChild process at findChildWithLabel [#2176](https://github.com/labstack/echo/pull/2176)
67+
* Allow different param names in different methods with same path scheme [#2209](https://github.com/labstack/echo/pull/2209)
68+
* Add support for registering handlers for different 404 routes [#2217](https://github.com/labstack/echo/pull/2217)
69+
* Middlewares should use errors.As() instead of type assertion on HTTPError [#2227](https://github.com/labstack/echo/pull/2227)
70+
* Allow arbitrary HTTP method types to be added as routes [#2237](https://github.com/labstack/echo/pull/2237)
71+
72+
## v4.7.2 - 2022-03-16
73+
74+
**Fixes**
75+
76+
* Fix nil pointer exception when calling Start again after address binding error [#2131](https://github.com/labstack/echo/pull/2131)
77+
* Fix CSRF middleware not being able to extract token from multipart/form-data form [#2136](https://github.com/labstack/echo/pull/2136)
78+
* Fix Timeout middleware write race [#2126](https://github.com/labstack/echo/pull/2126)
79+
80+
**Enhancements**
81+
82+
* Recover middleware should not log panic for aborted handler [#2134](https://github.com/labstack/echo/pull/2134)
83+
84+
85+
## v4.7.1 - 2022-03-13
86+
87+
**Fixes**
88+
89+
* Fix `e.Static`, `.File()`, `c.Attachment()` being picky with paths starting with `./`, `../` and `/` after 4.7.0 introduced echo.Filesystem support (Go1.16+) [#2123](https://github.com/labstack/echo/pull/2123)
90+
91+
**Enhancements**
92+
93+
* Remove some unused code [#2116](https://github.com/labstack/echo/pull/2116)
94+
95+
96+
## v4.7.0 - 2022-03-01
97+
98+
**Enhancements**
99+
100+
* Add JWT, KeyAuth, CSRF multivalue extractors [#2060](https://github.com/labstack/echo/pull/2060)
101+
* Add LogErrorFunc to recover middleware [#2072](https://github.com/labstack/echo/pull/2072)
102+
* Add support for HEAD method query params binding [#2027](https://github.com/labstack/echo/pull/2027)
103+
* Improve filesystem support with echo.FileFS, echo.StaticFS, group.FileFS, group.StaticFS [#2064](https://github.com/labstack/echo/pull/2064)
104+
105+
**Fixes**
106+
107+
* Fix X-Real-IP bug, improve tests [#2007](https://github.com/labstack/echo/pull/2007)
108+
* Minor syntax fixes [#1994](https://github.com/labstack/echo/pull/1994), [#2102](https://github.com/labstack/echo/pull/2102), [#2102](https://github.com/labstack/echo/pull/2102)
109+
110+
**General**
111+
112+
* Add cache-control and connection headers [#2103](https://github.com/labstack/echo/pull/2103)
113+
* Add Retry-After header constant [#2078](https://github.com/labstack/echo/pull/2078)
114+
* Upgrade `go` directive in `go.mod` to 1.17 [#2049](https://github.com/labstack/echo/pull/2049)
115+
* Add Pagoda [#2077](https://github.com/labstack/echo/pull/2077) and Souin [#2069](https://github.com/labstack/echo/pull/2069) to 3rd-party middlewares in README
116+
3117
## v4.6.3 - 2022-01-10
4118

5119
**Fixes**

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ tag:
99
check: lint vet race ## Check project
1010

1111
init:
12-
@go get -u golang.org/x/lint/golint
12+
@go install golang.org/x/lint/golint@latest
13+
@go install honnef.co/go/tools/cmd/staticcheck@latest
1314

1415
lint: ## Lint the files
16+
@staticcheck ${PKG_LIST}
1517
@golint -set_exit_status ${PKG_LIST}
1618

1719
vet: ## Vet the files
@@ -29,6 +31,6 @@ benchmark: ## Run benchmarks
2931
help: ## Display this help screen
3032
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
3133

32-
goversion ?= "1.15"
33-
test_version: ## Run tests inside Docker with given version (defaults to 1.15 oldest supported). Example: make test_version goversion=1.15
34+
goversion ?= "1.17"
35+
test_version: ## Run tests inside Docker with given version (defaults to 1.17 oldest supported). Example: make test_version goversion=1.17
3436
@docker run --rm -it -v $(shell pwd):/project golang:$(goversion) /bin/sh -c "cd /project && make init check"

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@
1111

1212
## Supported Go versions
1313

14+
Latest version of Echo supports last four Go major [releases](https://go.dev/doc/devel/release) and might work with older versions.
15+
1416
As of version 4.0.0, Echo is available as a [Go module](https://github.com/golang/go/wiki/Modules).
1517
Therefore a Go version capable of understanding /vN suffixed imports is required:
1618

17-
- 1.9.7+
18-
- 1.10.3+
19-
- 1.14+
2019

2120
Any of these versions will allow you to import Echo as `github.com/labstack/echo/v4` which is the recommended
2221
way of using Echo going forward.
@@ -93,15 +92,16 @@ func hello(c echo.Context) error {
9392

9493
# Third-party middlewares
9594

96-
| Repository | Description |
97-
|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
98-
| [github.com/labstack/echo-contrib](https://github.com/labstack/echo-contrib) | (by Echo team) [casbin](https://github.com/casbin/casbin), [gorilla/sessions](https://github.com/gorilla/sessions), [jaegertracing](github.com/uber/jaeger-client-go), [prometheus](https://github.com/prometheus/client_golang/), [pprof](https://pkg.go.dev/net/http/pprof), [zipkin](https://github.com/openzipkin/zipkin-go) middlewares |
99-
| [deepmap/oapi-codegen](https://github.com/deepmap/oapi-codegen) | Automatically generate RESTful API documentation with [OpenAPI](https://swagger.io/specification/) Client and Server Code Generator |
100-
| [github.com/swaggo/echo-swagger](https://github.com/swaggo/echo-swagger) | Automatically generate RESTful API documentation with [Swagger](https://swagger.io/) 2.0. |
101-
| [github.com/ziflex/lecho](https://github.com/ziflex/lecho) | [Zerolog](https://github.com/rs/zerolog) logging library wrapper for Echo logger interface. |
102-
| [github.com/brpaz/echozap](https://github.com/brpaz/echozap) | Uber´s [Zap](https://github.com/uber-go/zap) logging library wrapper for Echo logger interface. |
103-
| [github.com/darkweak/souin/plugins/echo](https://github.com/darkweak/souin/tree/master/plugins/echo) | HTTP cache system based on [Souin](https://github.com/darkweak/souin) to automatically get your endpoints cached. It supports some distributed and non-distributed storage systems depending your needs. |
104-
| [github.com/mikestefanello/pagoda](https://github.com/mikestefanello/pagoda) | Rapid, easy full-stack web development starter kit built with Echo.
95+
| Repository | Description |
96+
|------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
97+
| [github.com/labstack/echo-contrib](https://github.com/labstack/echo-contrib) | (by Echo team) [casbin](https://github.com/casbin/casbin), [gorilla/sessions](https://github.com/gorilla/sessions), [jaegertracing](github.com/uber/jaeger-client-go), [prometheus](https://github.com/prometheus/client_golang/), [pprof](https://pkg.go.dev/net/http/pprof), [zipkin](https://github.com/openzipkin/zipkin-go) middlewares |
98+
| [deepmap/oapi-codegen](https://github.com/deepmap/oapi-codegen) | Automatically generate RESTful API documentation with [OpenAPI](https://swagger.io/specification/) Client and Server Code Generator |
99+
| [github.com/swaggo/echo-swagger](https://github.com/swaggo/echo-swagger) | Automatically generate RESTful API documentation with [Swagger](https://swagger.io/) 2.0. |
100+
| [github.com/ziflex/lecho](https://github.com/ziflex/lecho) | [Zerolog](https://github.com/rs/zerolog) logging library wrapper for Echo logger interface. |
101+
| [github.com/brpaz/echozap](https://github.com/brpaz/echozap) | Uber´s [Zap](https://github.com/uber-go/zap) logging library wrapper for Echo logger interface. |
102+
| [github.com/darkweak/souin/plugins/echo](https://github.com/darkweak/souin/tree/master/plugins/echo) | HTTP cache system based on [Souin](https://github.com/darkweak/souin) to automatically get your endpoints cached. It supports some distributed and non-distributed storage systems depending your needs. |
103+
| [github.com/mikestefanello/pagoda](https://github.com/mikestefanello/pagoda) | Rapid, easy full-stack web development starter kit built with Echo. |
104+
| [github.com/go-woo/protoc-gen-echo](https://github.com/go-woo/protoc-gen-echo) | ProtoBuf generate Echo server side code |
105105

106106
Please send a PR to add your own library here.
107107

0 commit comments

Comments
 (0)