From 43e6e7e2d5bcfde86f18ce2144fe13a4d0fcb3be Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Tue, 22 Aug 2023 20:46:29 -0400 Subject: [PATCH] Upgrade to go 1.21 --- .github/workflows/build.yml | 2 +- .github/workflows/run-tests.yml | 2 +- Dockerfile | 6 +++--- go.mod | 3 +-- go.sum | 2 -- http/http.go | 2 +- main.go | 3 +-- server/server.go | 2 +- services/dynamodb/dynamodb.go | 3 +-- services/dynamodb/http.go | 2 +- services/kinesis/consumer.go | 3 +-- services/kinesis/http.go | 2 +- services/kinesis/itest/consumer_test.go | 2 +- services/kinesis/kinesis.go | 3 +-- services/kinesis/kinesis_test.go | 3 +-- services/kms/http.go | 2 +- services/kms/itest/kms_test.go | 2 +- services/kms/key/key.go | 5 ++--- services/kms/kms.go | 2 +- services/s3/handler.go | 3 +-- services/s3/itest/s3_test.go | 2 +- services/s3/s3.go | 4 ++-- services/sqs/http.go | 2 +- services/sqs/sqs.go | 5 ++--- 24 files changed, 28 insertions(+), 39 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b7cf715..876d16d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.20' + go-version: "1.21" - name: Build run: GOOS=${{ matrix.go_os }} GOARCH=${{ matrix.go_arch }} CGO_ENABLED=0 go build -ldflags "-w" -trimpath -o ./aws-in-a-box-${{ matrix.go_os }}-${{ matrix.go_arch }} diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index b51b279..25221f5 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -12,7 +12,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.20' + go-version: "1.21" - name: Build run: go build -v ./... diff --git a/Dockerfile b/Dockerfile index ed99160..80f1fba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -FROM golang:1.20.5-alpine AS build -WORKDIR src/ -COPY go.mod go.sum . +FROM golang:1.21.0-alpine AS build +WORKDIR /src/ +COPY go.mod go.sum ./ RUN go mod download COPY . . RUN CGO_ENABLED=0 go build -ldflags "-w" -trimpath -o /aws-in-a-box diff --git a/go.mod b/go.mod index 7345766..5234505 100755 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module aws-in-a-box -go 1.20 +go 1.21 require ( github.com/aws/aws-sdk-go-v2 v1.20.0 @@ -11,7 +11,6 @@ require ( github.com/fxamacker/cbor/v2 v2.4.0 github.com/gofrs/uuid/v5 v5.0.0 github.com/google/go-cmp v0.5.9 - golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b golang.org/x/net v0.14.0 ) diff --git a/go.sum b/go.sum index 56f16b6..ac0004e 100755 --- a/go.sum +++ b/go.sum @@ -42,8 +42,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= -golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b h1:r+vk0EmXNmekl0S0BascoeeoHk/L7wmaW2QF90K+kYI= -golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= diff --git a/http/http.go b/http/http.go index 9d431c0..2b5051c 100755 --- a/http/http.go +++ b/http/http.go @@ -8,11 +8,11 @@ import ( "fmt" "hash/crc32" "io" + "log/slog" "net/http" "strconv" "github.com/fxamacker/cbor/v2" - "golang.org/x/exp/slog" "aws-in-a-box/awserrors" ) diff --git a/main.go b/main.go index a563172..5e249e4 100755 --- a/main.go +++ b/main.go @@ -3,13 +3,12 @@ package main import ( "flag" "log" + "log/slog" "os" "runtime/debug" "strings" "time" - "golang.org/x/exp/slog" - "aws-in-a-box/arn" "aws-in-a-box/http" "aws-in-a-box/server" diff --git a/server/server.go b/server/server.go index 7a93e06..b7d701e 100644 --- a/server/server.go +++ b/server/server.go @@ -3,10 +3,10 @@ package server import ( "bytes" "io" + "log/slog" "net/http" "github.com/gofrs/uuid/v5" - "golang.org/x/exp/slog" "golang.org/x/net/http2" "golang.org/x/net/http2/h2c" ) diff --git a/services/dynamodb/dynamodb.go b/services/dynamodb/dynamodb.go index 181f7b1..260e40e 100755 --- a/services/dynamodb/dynamodb.go +++ b/services/dynamodb/dynamodb.go @@ -1,11 +1,10 @@ package dynamodb import ( + "log/slog" "reflect" "sync" - "golang.org/x/exp/slog" - "aws-in-a-box/arn" "aws-in-a-box/awserrors" ) diff --git a/services/dynamodb/http.go b/services/dynamodb/http.go index d1a9a2e..5632b2a 100755 --- a/services/dynamodb/http.go +++ b/services/dynamodb/http.go @@ -1,7 +1,7 @@ package dynamodb import ( - "golang.org/x/exp/slog" + "log/slog" "aws-in-a-box/http" ) diff --git a/services/kinesis/consumer.go b/services/kinesis/consumer.go index 0a81d26..073ada2 100755 --- a/services/kinesis/consumer.go +++ b/services/kinesis/consumer.go @@ -3,10 +3,9 @@ package kinesis import ( "fmt" "regexp" + "slices" "time" - "golang.org/x/exp/slices" - "aws-in-a-box/arn" "aws-in-a-box/awserrors" ) diff --git a/services/kinesis/http.go b/services/kinesis/http.go index bd8fd83..04e98a3 100755 --- a/services/kinesis/http.go +++ b/services/kinesis/http.go @@ -1,7 +1,7 @@ package kinesis import ( - "golang.org/x/exp/slog" + "log/slog" "aws-in-a-box/http" ) diff --git a/services/kinesis/itest/consumer_test.go b/services/kinesis/itest/consumer_test.go index 583f88c..c124002 100644 --- a/services/kinesis/itest/consumer_test.go +++ b/services/kinesis/itest/consumer_test.go @@ -3,6 +3,7 @@ package itest import ( "bytes" "context" + "log/slog" "net" "net/http" "testing" @@ -10,7 +11,6 @@ import ( "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/kinesis" "github.com/aws/aws-sdk-go-v2/service/kinesis/types" - "golang.org/x/exp/slog" "aws-in-a-box/arn" "aws-in-a-box/server" diff --git a/services/kinesis/kinesis.go b/services/kinesis/kinesis.go index 1c1e544..6542980 100755 --- a/services/kinesis/kinesis.go +++ b/services/kinesis/kinesis.go @@ -3,14 +3,13 @@ package kinesis import ( "crypto/md5" "fmt" + "log/slog" "math/big" "strconv" "strings" "sync" "time" - "golang.org/x/exp/slog" - "aws-in-a-box/arn" "aws-in-a-box/awserrors" ) diff --git a/services/kinesis/kinesis_test.go b/services/kinesis/kinesis_test.go index b2dcf07..19a497b 100644 --- a/services/kinesis/kinesis_test.go +++ b/services/kinesis/kinesis_test.go @@ -1,12 +1,11 @@ package kinesis import ( + "slices" "strconv" "strings" "testing" - "golang.org/x/exp/slices" - "aws-in-a-box/arn" ) diff --git a/services/kms/http.go b/services/kms/http.go index b012958..d4f8278 100755 --- a/services/kms/http.go +++ b/services/kms/http.go @@ -1,7 +1,7 @@ package kms import ( - "golang.org/x/exp/slog" + "log/slog" "aws-in-a-box/http" ) diff --git a/services/kms/itest/kms_test.go b/services/kms/itest/kms_test.go index 4a431c0..e461b6f 100644 --- a/services/kms/itest/kms_test.go +++ b/services/kms/itest/kms_test.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "errors" + "log/slog" "net" "net/http" "os" @@ -15,7 +16,6 @@ import ( "github.com/aws/aws-sdk-go-v2/service/kms/types" "github.com/aws/smithy-go" "github.com/google/go-cmp/cmp" - "golang.org/x/exp/slog" "aws-in-a-box/arn" "aws-in-a-box/server" diff --git a/services/kms/key/key.go b/services/kms/key/key.go index 73e4b87..e18f84e 100644 --- a/services/kms/key/key.go +++ b/services/kms/key/key.go @@ -13,12 +13,11 @@ import ( "errors" "fmt" "hash" + "maps" "os" + "slices" "time" - "golang.org/x/exp/maps" - "golang.org/x/exp/slices" - "aws-in-a-box/atomicfile" "aws-in-a-box/services/kms/types" ) diff --git a/services/kms/kms.go b/services/kms/kms.go index 2d6560d..204ae8e 100644 --- a/services/kms/kms.go +++ b/services/kms/kms.go @@ -15,6 +15,7 @@ import ( "errors" "fmt" "hash" + "log/slog" "os" "path/filepath" "regexp" @@ -24,7 +25,6 @@ import ( "time" "github.com/gofrs/uuid/v5" - "golang.org/x/exp/slog" "aws-in-a-box/arn" "aws-in-a-box/atomicfile" diff --git a/services/s3/handler.go b/services/s3/handler.go index c3dbaae..bd14cb7 100644 --- a/services/s3/handler.go +++ b/services/s3/handler.go @@ -3,13 +3,12 @@ package s3 import ( "encoding/xml" "io" + "log/slog" "net/http" "reflect" "strconv" "strings" - "golang.org/x/exp/slog" - "aws-in-a-box/awserrors" ) diff --git a/services/s3/itest/s3_test.go b/services/s3/itest/s3_test.go index 9234fad..fa08c56 100644 --- a/services/s3/itest/s3_test.go +++ b/services/s3/itest/s3_test.go @@ -3,6 +3,7 @@ package itest import ( "context" "io" + "log/slog" "net" "net/http" "reflect" @@ -13,7 +14,6 @@ import ( "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/s3" "github.com/aws/aws-sdk-go-v2/service/s3/types" - "golang.org/x/exp/slog" "aws-in-a-box/server" s3Impl "aws-in-a-box/services/s3" diff --git a/services/s3/s3.go b/services/s3/s3.go index c8289a0..5081764 100644 --- a/services/s3/s3.go +++ b/services/s3/s3.go @@ -6,17 +6,17 @@ import ( "encoding/hex" "fmt" "io" + "log/slog" "net/url" "os" "path/filepath" + "slices" "strconv" "strings" "sync" "time" "github.com/gofrs/uuid/v5" - "golang.org/x/exp/slices" - "golang.org/x/exp/slog" "aws-in-a-box/atomicfile" "aws-in-a-box/awserrors" diff --git a/services/sqs/http.go b/services/sqs/http.go index 5d9814f..6f3cd46 100755 --- a/services/sqs/http.go +++ b/services/sqs/http.go @@ -1,7 +1,7 @@ package sqs import ( - "golang.org/x/exp/slog" + "log/slog" "aws-in-a-box/http" ) diff --git a/services/sqs/sqs.go b/services/sqs/sqs.go index 207a1f3..ecc2fbf 100755 --- a/services/sqs/sqs.go +++ b/services/sqs/sqs.go @@ -1,11 +1,10 @@ package sqs import ( + "log/slog" + "maps" "sync" - "golang.org/x/exp/maps" - "golang.org/x/exp/slog" - "aws-in-a-box/arn" "aws-in-a-box/awserrors" )