Skip to content

Commit

Permalink
ci: 仅支持 go1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
caixw committed Nov 20, 2023
1 parent aad72d1 commit 40d3760
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
go: ['1.20.x', '1.21.x']
go: ['1.21.x']

services:
memcached:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
go: ['1.20.x', '1.21.x']
go: ['1.21.x']

steps:

Expand Down
6 changes: 3 additions & 3 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
"fmt"
"io"
"net/http"
"slices"
"strings"
"sync"
"time"

"github.com/issue9/mux/v7/types"
"github.com/issue9/sliceutil"
"golang.org/x/text/encoding"
"golang.org/x/text/language"
"golang.org/x/text/message"
Expand Down Expand Up @@ -184,7 +184,7 @@ func (b *ContextBuilder) NewContext(w http.ResponseWriter, r *http.Request, rout
ctx.inputCharset = inputCharset
ctx.languageTag = tag
ctx.localePrinter = b.server.Locale().NewPrinter(tag)
ctx.vars = map[any]any{} // TODO: go1.21 可以改为 clear(ctx.vars)
clear(ctx.vars)
ctx.logs = b.server.Logs().New(map[string]any{b.requestIDKey: id})

return ctx
Expand Down Expand Up @@ -300,7 +300,7 @@ func (ctx *Context) LocalePrinter() *message.Printer { return ctx.localePrinter
func (ctx *Context) LanguageTag() language.Tag { return ctx.languageTag }

func (ctx *Context) Free() {
sliceutil.Reverse(ctx.exits) // TODO: go1.21 改为标准库
slices.Reverse(ctx.exits)
for _, exit := range ctx.exits {
exit(ctx, ctx.status)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ require (
golang.org/x/sys v0.14.0 // indirect
)

go 1.20
go 1.21
4 changes: 2 additions & 2 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import (
"context"
"errors"
"net/http"
"slices"
"sync"
"time"

"github.com/issue9/config"
"github.com/issue9/mux/v7/group"
"github.com/issue9/sliceutil"

"github.com/issue9/web"
"github.com/issue9/web/cache"
Expand Down Expand Up @@ -145,7 +145,7 @@ func (srv *httpServer) Close(shutdownTimeout time.Duration) {
}

defer func() {
sliceutil.Reverse(srv.closes) // TODO: go1.21 改为标准库
slices.Reverse(srv.closes)
for _, f := range srv.closes { // 仅在用户主动要关闭时,才关闭服务。
if err1 := f(); err1 != nil { // 出错不退出,继续其它操作。
srv.Logs().ERROR().Error(err1)
Expand Down

0 comments on commit 40d3760

Please sign in to comment.