Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Go 1.23 to CI #2675

Merged
merged 3 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ permissions:

env:
# run static analysis only with the latest Go version
LATEST_GO_VERSION: "1.22"
LATEST_GO_VERSION: "1.23"

jobs:
check:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/echo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ permissions:

env:
# run coverage and benchmarks only with the latest Go version
LATEST_GO_VERSION: "1.22"
LATEST_GO_VERSION: "1.23"

jobs:
test:
Expand All @@ -25,7 +25,7 @@ jobs:
# Echo tests with last four major releases (unless there are pressing vulnerabilities)
# As we depend on `golang.org/x/` libraries which only support last 2 Go releases we could have situations when
# we derive from last four major releases promise.
go: ["1.19", "1.20", "1.21", "1.22"]
go: ["1.20", "1.21", "1.22", "1.23"]
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
runs-on: ${{ matrix.os }}
steps:
Expand Down
17 changes: 7 additions & 10 deletions echo_fs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,19 +245,16 @@ func TestEcho_FileFS(t *testing.T) {

func TestEcho_StaticPanic(t *testing.T) {
var testCases = []struct {
name string
givenRoot string
expectError string
name string
givenRoot string
}{
{
name: "panics for ../",
givenRoot: "../assets",
expectError: "can not create sub FS, invalid root given, err: sub ../assets: invalid name",
name: "panics for ../",
givenRoot: "../assets",
},
{
name: "panics for /",
givenRoot: "/assets",
expectError: "can not create sub FS, invalid root given, err: sub /assets: invalid name",
name: "panics for /",
givenRoot: "/assets",
},
}

Expand All @@ -266,7 +263,7 @@ func TestEcho_StaticPanic(t *testing.T) {
e := New()
e.Filesystem = os.DirFS("./")

assert.PanicsWithError(t, tc.expectError, func() {
assert.Panics(t, func() {
e.Static("../assets", tc.givenRoot)
})
})
Expand Down
17 changes: 7 additions & 10 deletions group_fs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,16 @@ func TestGroup_FileFS(t *testing.T) {

func TestGroup_StaticPanic(t *testing.T) {
var testCases = []struct {
name string
givenRoot string
expectError string
name string
givenRoot string
}{
{
name: "panics for ../",
givenRoot: "../images",
expectError: "can not create sub FS, invalid root given, err: sub ../images: invalid name",
name: "panics for ../",
givenRoot: "../images",
},
{
name: "panics for /",
givenRoot: "/images",
expectError: "can not create sub FS, invalid root given, err: sub /images: invalid name",
name: "panics for /",
givenRoot: "/images",
},
}

Expand All @@ -98,7 +95,7 @@ func TestGroup_StaticPanic(t *testing.T) {

g := e.Group("/assets")

assert.PanicsWithError(t, tc.expectError, func() {
assert.Panics(t, func() {
g.Static("/images", tc.givenRoot)
})
})
Expand Down
4 changes: 2 additions & 2 deletions middleware/body_dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ func (w *bodyDumpResponseWriter) Write(b []byte) (int, error) {
}

func (w *bodyDumpResponseWriter) Flush() {
err := responseControllerFlush(w.ResponseWriter)
err := http.NewResponseController(w.ResponseWriter).Flush()
if err != nil && errors.Is(err, http.ErrNotSupported) {
panic(errors.New("response writer flushing is not supported"))
}
}

func (w *bodyDumpResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
return responseControllerHijack(w.ResponseWriter)
return http.NewResponseController(w.ResponseWriter).Hijack()
}

func (w *bodyDumpResponseWriter) Unwrap() http.ResponseWriter {
Expand Down
4 changes: 2 additions & 2 deletions middleware/compress.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,15 @@ func (w *gzipResponseWriter) Flush() {
}

w.Writer.(*gzip.Writer).Flush()
_ = responseControllerFlush(w.ResponseWriter)
_ = http.NewResponseController(w.ResponseWriter).Flush()
}

func (w *gzipResponseWriter) Unwrap() http.ResponseWriter {
return w.ResponseWriter
}

func (w *gzipResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
return responseControllerHijack(w.ResponseWriter)
return http.NewResponseController(w.ResponseWriter).Hijack()
}

func (w *gzipResponseWriter) Push(target string, opts *http.PushOptions) error {
Expand Down
44 changes: 0 additions & 44 deletions middleware/responsecontroller_1.19.go

This file was deleted.

20 changes: 0 additions & 20 deletions middleware/responsecontroller_1.20.go

This file was deleted.

4 changes: 2 additions & 2 deletions response.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (r *Response) Write(b []byte) (n int, err error) {
// buffered data to the client.
// See [http.Flusher](https://golang.org/pkg/net/http/#Flusher)
func (r *Response) Flush() {
err := responseControllerFlush(r.Writer)
err := http.NewResponseController(r.Writer).Flush()
if err != nil && errors.Is(err, http.ErrNotSupported) {
panic(errors.New("response writer flushing is not supported"))
}
Expand All @@ -96,7 +96,7 @@ func (r *Response) Flush() {
// take over the connection.
// See [http.Hijacker](https://golang.org/pkg/net/http/#Hijacker)
func (r *Response) Hijack() (net.Conn, *bufio.ReadWriter, error) {
return responseControllerHijack(r.Writer)
return http.NewResponseController(r.Writer).Hijack()
}

// Unwrap returns the original http.ResponseWriter.
Expand Down
44 changes: 0 additions & 44 deletions responsecontroller_1.19.go

This file was deleted.

20 changes: 0 additions & 20 deletions responsecontroller_1.20.go

This file was deleted.

Loading