Skip to content
This repository has been archived by the owner on May 18, 2024. It is now read-only.

Commit

Permalink
Build with Go 1.21rc3 (#511)
Browse files Browse the repository at this point in the history
* Build with Go 1.21rc3

* Fix usage of slog
  • Loading branch information
fsouza authored Jul 24, 2023
1 parent aca277d commit 71405d3
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- uses: actions/[email protected]
with:
go-version: "1.20"
go-version: "1.21.0-rc.3"

- uses: goreleaser/[email protected]
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- uses: actions/[email protected]
with:
go-version: "1.20"
go-version: "1.21.0-rc.3"

- uses: goreleaser/[email protected]
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

- uses: actions/[email protected]
with:
go-version: "1.20"
go-version: "1.21.0-rc.3"

- name: run-tests
run: go test -race -vet all ./...
Expand All @@ -40,7 +40,7 @@ jobs:
- uses: actions/[email protected]
id: setup-go
with:
go-version: "1.20"
go-version: "1.21.0-rc.3"

- run: |
go install honnef.co/go/tools/cmd/staticcheck@master
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20.6-alpine AS build
FROM golang:1.21rc3-alpine AS build

ENV CGO_ENABLED 0
WORKDIR /code
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ module github.com/fsouza/s3-upload-proxy
require (
github.com/aws/aws-sdk-go v1.44.300
github.com/kelseyhightower/envconfig v1.4.0
golang.org/x/exp v0.0.0-20221114191408-850992195362
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
)

go 1.20
go 1.21
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20221114191408-850992195362 h1:NoHlPRbyl1VFI6FjwHtPQCN7wAMXI6cKcqrmXhOOfBQ=
golang.org/x/exp v0.0.0-20221114191408-850992195362/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
Expand Down
14 changes: 7 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"log"
"log/slog"
"mime"
"net"
"net/http"
Expand All @@ -21,7 +22,6 @@ import (
"github.com/fsouza/s3-upload-proxy/internal/uploader/mediastore"
"github.com/fsouza/s3-upload-proxy/internal/uploader/s3"
"github.com/kelseyhightower/envconfig"
"golang.org/x/exp/slog"
)

// Config is the configuration of the s3-uploader.
Expand Down Expand Up @@ -62,14 +62,14 @@ func (c *Config) uploader() (uploader.Uploader, error) {

func (c *Config) logger() *slog.Logger {
levels := map[string]slog.Level{
"debug": slog.DebugLevel,
"info": slog.InfoLevel,
"warning": slog.WarnLevel,
"warn": slog.WarnLevel,
"error": slog.ErrorLevel,
"debug": slog.LevelDebug,
"info": slog.LevelInfo,
"warning": slog.LevelWarn,
"warn": slog.LevelWarn,
"error": slog.LevelError,
}
opts := slog.HandlerOptions{Level: levels[c.LogLevel]}
return slog.New(opts.NewTextHandler(os.Stderr))
return slog.New(slog.NewTextHandler(os.Stderr, &opts))
}

func healthcheck(w http.ResponseWriter, r *http.Request) {
Expand Down

0 comments on commit 71405d3

Please sign in to comment.