Skip to content

Commit

Permalink
chore: upgrade to go 1.19
Browse files Browse the repository at this point in the history
chore: fix linter errors
  • Loading branch information
Vilsol committed Sep 1, 2022
1 parent d28b5bf commit 94eebaa
Show file tree
Hide file tree
Showing 21 changed files with 42 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19

- name: Check out code into the Go module directory
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19

- name: Check out code into the Go module directory
uses: actions/checkout@v2
Expand Down
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ linters-settings:
ignorePackageGlobs:
- github.com/satisfactorymodding/smr-api/*

issues:
exclude:
- should pass the context parameter

linters:
disable-all: true
enable:
Expand Down
3 changes: 1 addition & 2 deletions cmd/validate-zip/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"context"
"io/ioutil"
"os"

"github.com/satisfactorymodding/smr-api/validation"
Expand All @@ -13,7 +12,7 @@ func main() {
return
}

f, _ := ioutil.ReadFile(os.Args[1])
f, _ := os.ReadFile(os.Args[1])

validation.InitializeValidator()
_, err := validation.ExtractModInfo(context.Background(), f, true, true, "N/A")
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/satisfactorymodding/smr-api

go 1.18
go 1.19

require (
github.com/99designs/gqlgen v0.17.5
Expand Down Expand Up @@ -31,6 +31,7 @@ require (
github.com/spf13/viper v1.11.0
github.com/swaggo/echo-swagger v1.3.2
github.com/swaggo/swag v1.8.1
github.com/vektah/gqlparser/v2 v2.4.2
github.com/vmihailenco/taskq/extra/taskqotel/v3 v3.2.8
github.com/vmihailenco/taskq/v3 v3.2.8
github.com/xeipuuv/gojsonschema v1.2.0
Expand All @@ -42,6 +43,7 @@ require (
go.opentelemetry.io/otel/sdk v1.7.0
go.opentelemetry.io/otel/trace v1.7.0
golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5
gopkg.in/go-playground/validator.v9 v9.31.0
gorm.io/driver/postgres v1.3.5
Expand Down Expand Up @@ -126,7 +128,6 @@ require (
github.com/urfave/cli/v2 v2.4.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.1 // indirect
github.com/vektah/gqlparser/v2 v2.4.2 // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
Expand All @@ -137,7 +138,6 @@ require (
go.uber.org/atomic v1.7.0 // indirect
golang.org/x/exp v0.0.0-20210220032938-85be41e4509f // indirect
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
Expand Down
13 changes: 1 addition & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E
cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY=
cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM=
cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY=
cloud.google.com/go v0.88.0/go.mod h1:dnKwfYbP9hQhefiUvpbcAyoGSHUrOxR20JVElLiUvEY=
cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ=
cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI=
cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4=
Expand Down Expand Up @@ -160,7 +159,6 @@ github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdK
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/avast/retry-go/v3 v3.1.1 h1:49Scxf4v8PmiQ/nY0aY3p0hDueqSmc7++cBbtiDGu2g=
Expand Down Expand Up @@ -699,10 +697,8 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe
github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210715191844-86eeefc3e471/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
Expand Down Expand Up @@ -751,7 +747,6 @@ github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
Expand Down Expand Up @@ -1114,7 +1109,6 @@ github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6
github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo=
github.com/otiai10/mint v1.3.3/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
Expand Down Expand Up @@ -1361,9 +1355,7 @@ go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4=
go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489/go.mod h1:yVHk9ub3CSBatqGNg7GRmsnfLWtoW60w4eDYfh7vHDg=
go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=
go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=
go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=
go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=
go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ=
go.etcd.io/etcd/client/v3 v3.5.0/go.mod h1:AIKXXVX/DQXtfTEqBryiLTUXwON+GuvO6Z7lLS/oTh0=
go.etcd.io/etcd/pkg/v3 v3.5.0/go.mod h1:UzJGatBQ1lXChBkQF0AuAtkRQMYnHubxAEYIrC3MSsE=
Expand Down Expand Up @@ -1456,7 +1448,6 @@ golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
Expand Down Expand Up @@ -1580,13 +1571,13 @@ golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0/go.mod h1:sp8m0HH+o8qH0wwXwY
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8=
golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
Expand Down Expand Up @@ -1996,8 +1987,6 @@ google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+n
google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U=
google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k=
google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k=
google.golang.org/genproto v0.0.0-20210721163202-f1cecdd8b78a/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=
google.golang.org/genproto v0.0.0-20210726143408-b02e89920bf0/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=
google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=
google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=
google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w=
Expand Down
6 changes: 3 additions & 3 deletions gql/resolver_mods.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package gql
import (
"bytes"
"context"
"io/ioutil"
"io"
"time"

"github.com/satisfactorymodding/smr-api/dataloader"
Expand Down Expand Up @@ -54,7 +54,7 @@ func (r *mutationResolver) CreateMod(ctx context.Context, mod generated.NewMod)
var logoData []byte

if mod.Logo != nil {
file, err := ioutil.ReadAll(mod.Logo.File)
file, err := io.ReadAll(mod.Logo.File)

if err != nil {
return nil, errors.Wrap(err, "failed to read logo file")
Expand Down Expand Up @@ -127,7 +127,7 @@ func (r *mutationResolver) UpdateMod(ctx context.Context, modID string, mod gene
SetCompatibilityINN(mod.Compatibility, &dbMod.Compatibility)

if mod.Logo != nil {
file, err := ioutil.ReadAll(mod.Logo.File)
file, err := io.ReadAll(mod.Logo.File)

if err != nil {
return nil, errors.Wrap(err, "failed to read logo file")
Expand Down
4 changes: 2 additions & 2 deletions gql/resolver_users.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"crypto/sha256"
"encoding/base64"
"encoding/hex"
"io/ioutil"
"io"
"net/http"
"net/url"

Expand Down Expand Up @@ -35,7 +35,7 @@ func (r *mutationResolver) UpdateUser(ctx context.Context, userID string, input
}

if input.Avatar != nil {
file, err := ioutil.ReadAll(input.Avatar.File)
file, err := io.ReadAll(input.Avatar.File)

if err != nil {
return nil, errors.Wrap(err, "failed to read avatar file")
Expand Down
4 changes: 2 additions & 2 deletions gql/resolver_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package gql
import (
"bytes"
"context"
"io/ioutil"
"io"
"runtime/debug"
"time"

Expand Down Expand Up @@ -71,7 +71,7 @@ func (r *mutationResolver) UploadVersionPart(ctx context.Context, modID string,
}

// TODO Optimize
fileData, err := ioutil.ReadAll(file.File)
fileData, err := io.ReadAll(file.File)

if err != nil {
return false, errors.Wrap(err, "failed to read file")
Expand Down
4 changes: 2 additions & 2 deletions gql/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package gql
import (
"context"
"encoding/json"
"io/ioutil"
"io"
"time"

"github.com/satisfactorymodding/smr-api/db/postgres"
Expand Down Expand Up @@ -38,7 +38,7 @@ func FinalizeVersionUploadAsync(ctx context.Context, mod *postgres.Mod, versionI
}

// TODO Optimize
fileData, err := ioutil.ReadAll(modFile)
fileData, err := io.ReadAll(modFile)

if err != nil {
storage.DeleteMod(ctx, mod.ID, mod.Name, versionID)
Expand Down
5 changes: 2 additions & 3 deletions integrations/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"encoding/json"
"html"
"io"
"io/ioutil"
"net/http"
"runtime/debug"
"strings"
Expand Down Expand Up @@ -76,7 +75,7 @@ func NewMod(ctx context.Context, mod *postgres.Mod) {
_ = Body.Close()
}(res.Body)

_, _ = ioutil.ReadAll(res.Body)
_, _ = io.ReadAll(res.Body)
}

func NewVersion(ctx context.Context, version *postgres.Version) {
Expand Down Expand Up @@ -161,5 +160,5 @@ func NewVersion(ctx context.Context, version *postgres.Version) {
_ = Body.Close()
}(res.Body)

_, _ = ioutil.ReadAll(res.Body)
_, _ = io.ReadAll(res.Body)
}
4 changes: 2 additions & 2 deletions oauth/facebook.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package oauth

import (
"encoding/json"
"io/ioutil"
"io"

"github.com/satisfactorymodding/smr-api/redis"

Expand Down Expand Up @@ -34,7 +34,7 @@ func FacebookCallback(code string, state string) (*UserData, error) {
return nil, errors.Wrap(err, "failed to get user data")
}

bytes, err := ioutil.ReadAll(resp.Body)
bytes, err := io.ReadAll(resp.Body)

if err != nil {
return nil, errors.Wrap(err, "failed to read response body")
Expand Down
6 changes: 3 additions & 3 deletions oauth/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package oauth

import (
"encoding/json"
"io/ioutil"
"io"
"strconv"

"github.com/satisfactorymodding/smr-api/redis"
Expand Down Expand Up @@ -31,7 +31,7 @@ func GithubCallback(code string, state string) (*UserData, error) {
return nil, errors.Wrap(err, "failed to get user data")
}

bytes, err := ioutil.ReadAll(resp.Body)
bytes, err := io.ReadAll(resp.Body)

if err != nil {
return nil, errors.Wrap(err, "failed to read user data")
Expand All @@ -50,7 +50,7 @@ func GithubCallback(code string, state string) (*UserData, error) {
return nil, errors.Wrap(err, "failed to get user emails")
}

bytes, err = ioutil.ReadAll(resp.Body)
bytes, err = io.ReadAll(resp.Body)

if err != nil {
return nil, errors.Wrap(err, "failed to read user emails")
Expand Down
4 changes: 2 additions & 2 deletions oauth/google.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package oauth

import (
"encoding/json"
"io/ioutil"
"io"

"github.com/satisfactorymodding/smr-api/redis"

Expand Down Expand Up @@ -33,7 +33,7 @@ func GoogleCallback(code string, state string) (*UserData, error) {
return nil, errors.Wrap(err, "failed to get user info")
}

bytes, err := ioutil.ReadAll(resp.Body)
bytes, err := io.ReadAll(resp.Body)

if err != nil {
return nil, errors.Wrap(err, "failed to read user info")
Expand Down
3 changes: 1 addition & 2 deletions redis/jobs/consumers/consumer_scan_mod_on_virus_total.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"context"
"encoding/json"
"io"
"io/ioutil"
"net/http"
"path"
"time"
Expand Down Expand Up @@ -44,7 +43,7 @@ func ScanModOnVirusTotalConsumer(ctx context.Context, payload []byte) error {

response, _ := http.Get(link)

fileData, err := ioutil.ReadAll(response.Body)
fileData, err := io.ReadAll(response.Body)

if err != nil {
return errors.Wrap(err, "failed to read mod file")
Expand Down
4 changes: 2 additions & 2 deletions redis/jobs/consumers/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package consumers
import (
"context"
"encoding/json"
"io/ioutil"
"io"
"net/http"

"github.com/satisfactorymodding/smr-api/db/postgres"
Expand All @@ -24,7 +24,7 @@ func UpdateModDataFromStorage(ctx context.Context, modID string, versionID strin

response, _ := http.Get(link)

fileData, err := ioutil.ReadAll(response.Body)
fileData, err := io.ReadAll(response.Body)

if err != nil {
return errors.Wrap(err, "failed to read response body")
Expand Down
3 changes: 2 additions & 1 deletion storage/b2.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/aws/aws-sdk-go/service/s3/s3manager"
"github.com/pkg/errors"
"github.com/rs/zerolog/log"

"github.com/satisfactorymodding/smr-api/redis"

"github.com/aws/aws-sdk-go/aws"
Expand Down Expand Up @@ -69,7 +70,7 @@ func (b2o *B2) Put(ctx context.Context, key string, body io.ReadSeeker) (string,
cleanedKey := strings.TrimPrefix(key, "/")
uploader := s3manager.NewUploader(b2o.S3Session)

_, err := uploader.Upload(&s3manager.UploadInput{
_, err := uploader.UploadWithContext(ctx, &s3manager.UploadInput{
Body: body,
Bucket: aws.String(b2o.Config.Bucket),
Key: aws.String(cleanedKey),
Expand Down
2 changes: 1 addition & 1 deletion storage/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (s3o *S3) Put(ctx context.Context, key string, body io.ReadSeeker) (string,

uploader := s3manager.NewUploader(s3o.S3Session)

_, err := uploader.Upload(&s3manager.UploadInput{
_, err := uploader.UploadWithContext(ctx, &s3manager.UploadInput{
Body: body,
Bucket: aws.String(viper.GetString("storage.bucket")),
Key: aws.String(cleanedKey),
Expand Down
Loading

0 comments on commit 94eebaa

Please sign in to comment.