From 87f96bb96f48b51e5a3b7651ed83bd55717dc45f Mon Sep 17 00:00:00 2001 From: ysugimoto Date: Sun, 28 Apr 2024 02:19:29 +0900 Subject: [PATCH] use golang 1.21.1 --- .golangci.yml | 6 +----- go.mod | 12 ++++++++++-- go.sum | 2 -- protoc-gen-graphql/generator/generator.go | 6 +++--- runtime/request.go | 4 ++-- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index a9e59aa..b549c71 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -10,7 +10,7 @@ run: issues: exclude-rules: - ## Add file patters to exclude linter + ## Add file patterns to exclude linter - path: grpc\/main\.go linters: - gomnd @@ -132,16 +132,12 @@ linters-settings: simplify: true golint: min-confidence: 0.8 - govet: - check-shadowing: true gomnd: settings: mnd: checks: argument,assign,operation,return lll: line-length: 120 - maligned: - suggest-new: true misspell: locale: US ignore-words: diff --git a/go.mod b/go.mod index c37dd44..23c966e 100644 --- a/go.mod +++ b/go.mod @@ -6,9 +6,17 @@ require ( github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0 github.com/graphql-go/graphql v0.7.8 github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334 - github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.6.1 - golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae // indirect google.golang.org/grpc v1.27.0 google.golang.org/protobuf v1.21.0 ) + +require ( + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + golang.org/x/net v0.0.0-20190311183353-d8887717615a // indirect + golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae // indirect + golang.org/x/text v0.3.0 // indirect + google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) diff --git a/go.sum b/go.sum index 576bdaa..7bf60f6 100644 --- a/go.sum +++ b/go.sum @@ -25,8 +25,6 @@ github.com/graphql-go/graphql v0.7.8 h1:769CR/2JNAhLG9+aa8pfLkKdR0H+r5lsQqling5W github.com/graphql-go/graphql v0.7.8/go.mod h1:k6yrAYQaSP59DC5UVxbgxESlmVyojThKdORUqGDGmrI= github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334 h1:VHgatEHNcBFEB7inlalqfNqw65aNkM1lGX2yt3NmbS8= github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/protoc-gen-graphql/generator/generator.go b/protoc-gen-graphql/generator/generator.go index b9fe70b..28f1278 100644 --- a/protoc-gen-graphql/generator/generator.go +++ b/protoc-gen-graphql/generator/generator.go @@ -4,11 +4,11 @@ import ( "bytes" "errors" "fmt" + "io" "os" "sort" "go/format" - "io/ioutil" "text/template" // nolint: staticcheck @@ -53,7 +53,7 @@ func New(files []*spec.File, args *spec.Params) *Generator { } } - w := ioutil.Discard + w := io.Discard if args.Verbose { w = os.Stderr } @@ -247,7 +247,7 @@ func (g *Generator) generateFile(file *spec.File, tmpl string, services []*spec. out, err := format.Source(buf.Bytes()) if err != nil { - ioutil.WriteFile("/tmp/"+root.Name+".go", buf.Bytes(), 0o666) // nolint: gomnd,errcheck + os.WriteFile("/tmp/"+root.Name+".go", buf.Bytes(), 0o666) // nolint: gomnd,errcheck return nil, err } diff --git a/runtime/request.go b/runtime/request.go index 9b71ac9..d53312b 100644 --- a/runtime/request.go +++ b/runtime/request.go @@ -4,7 +4,7 @@ import ( "errors" "encoding/json" - "io/ioutil" + "io" "net/http" "github.com/iancoleman/strcase" @@ -23,7 +23,7 @@ func parseRequest(r *http.Request) (*GraphqlRequest, error) { // Get request body switch r.Method { case http.MethodPost: - buf, err := ioutil.ReadAll(r.Body) + buf, err := io.ReadAll(r.Body) if err != nil { return nil, errors.New("malformed request body, " + err.Error()) }