diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc06fef..646918c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,37 +7,23 @@ jobs: name: Lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: - go-version: "1.19" # golangci-lint requires 1.19+ - - uses: actions/cache@v3 + go-version: "1.20" + - name: golangci-lint + uses: golangci/golangci-lint-action@v4 with: - path: | - bin/tools - ~/go/pkg/mod - key: ${{ runner.os }}-golangcilint-${{ hashFiles('**/Makefile') }} - restore-keys: | - ${{ runner.os }}-golangcilint- - - name: Run make lint - run: make lint - env: - GOLANGCILINTARGS: --out-format=github-actions + version: v1.56 tidy: name: Tidy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: "1.18" - - uses: actions/cache@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + go-version: "1.20" - name: Check if mods are tidy run: make check-tidy @@ -45,16 +31,10 @@ jobs: name: Generate runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: "1.18" - - uses: actions/cache@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + go-version: "1.20" - name: Check if generate results are up to date run: make check-generate @@ -62,18 +42,12 @@ jobs: name: Coverage runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: - go-version: "1.18" - - uses: actions/cache@v3 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + go-version: "1.20" - name: Publish coverage - uses: paambaati/codeclimate-action@v3.2.0 + uses: paambaati/codeclimate-action@v5.0.0 env: VERBOSE: "true" GOMAXPROCS: 4 @@ -90,21 +64,15 @@ jobs: fail-fast: false matrix: go_version: - - "1.18" - - "1.19" - "1.20" + - "1.21" + - "1.22" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: "${{ matrix.go_version }}" - - uses: actions/cache@v3 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - name: Run tests run: make test env: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 723a8b0..ed4e8cc 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -10,15 +10,9 @@ jobs: name: Schemas runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v5 with: - go-version: 1.15 - - uses: actions/cache@v2 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + go-version: 1.20 - name: Check if bundled schemas are up to date run: make check-schemas diff --git a/.golangci.yml b/.golangci.yml index 42f5997..d8dcdc0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -71,6 +71,7 @@ issues: linters: - funlen - dupl + - goconst - path: "_generated\\.go" linters: - funlen diff --git a/Makefile b/Makefile index 39bdf03..b46af44 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ endef $(eval $(call tool,godoc,golang.org/x/tools/cmd/godoc@latest)) $(eval $(call tool,gofumpt,mvdan.cc/gofumpt@latest)) $(eval $(call tool,goimports,golang.org/x/tools/cmd/goimports@latest)) -$(eval $(call tool,golangci-lint,github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51)) +$(eval $(call tool,golangci-lint,github.com/golangci/golangci-lint/cmd/golangci-lint@v1.56)) $(eval $(call tool,gomod,github.com/Helcaraxan/gomod@latest)) .PHONY: tools diff --git a/buildspec/virtual_machine_spec_test.go b/buildspec/virtual_machine_spec_test.go index 447b9be..0ab8073 100644 --- a/buildspec/virtual_machine_spec_test.go +++ b/buildspec/virtual_machine_spec_test.go @@ -426,7 +426,7 @@ func TestVirtualMachineSpec_ToFromJSON(t *testing.T) { } func TestVirtualMachineSpec_WriteJSON_Error(t *testing.T) { - errStr := "failed to write" //nolint:goconst + errStr := "failed to write" spec := &VirtualMachineSpec{Name: "web-3"} w := &badWriter{err: errors.New(errStr)} diff --git a/core/dns_zone_test.go b/core/dns_zone_test.go index 03bc4e0..e8e3c29 100644 --- a/core/dns_zone_test.go +++ b/core/dns_zone_test.go @@ -3,7 +3,7 @@ package core import ( "context" "encoding/json" - "io/ioutil" + "io" "net/http" "net/url" "testing" @@ -1637,7 +1637,7 @@ func TestDNSZonesClient_Verify(t *testing.T) { ) } - b, err := ioutil.ReadAll(r.Body) + b, err := io.ReadAll(r.Body) require.NoError(t, err) defer r.Body.Close() diff --git a/core/katapult_test.go b/core/katapult_test.go index d0ead23..dc5e6f9 100644 --- a/core/katapult_test.go +++ b/core/katapult_test.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "net/http/httptest" "net/url" @@ -53,7 +52,7 @@ func strictUmarshal(r io.Reader, v interface{}) error { func fixture(name string) []byte { file := fmt.Sprintf("fixtures/%s.json", name) - c, err := ioutil.ReadFile(file) + c, err := os.ReadFile(file) if err != nil { panic(err) } diff --git a/go.mod b/go.mod index 3b6e8f5..319fe2b 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/krystal/go-katapult -go 1.18 +go 1.20 require ( github.com/augurysys/timestamp v0.3.2 @@ -10,8 +10,8 @@ require ( github.com/jimeh/rands v0.3.0 github.com/jimeh/undent v1.1.1 github.com/mitchellh/copystructure v1.2.0 - github.com/stretchr/testify v1.8.2 - golang.org/x/text v0.7.0 + github.com/stretchr/testify v1.8.4 + golang.org/x/text v0.14.0 gopkg.in/yaml.v3 v3.0.1 mvdan.cc/gofumpt v0.4.0 ) @@ -22,11 +22,13 @@ require ( github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.17 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.mongodb.org/mongo-driver v1.11.2 // indirect - golang.org/x/mod v0.8.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/tools v0.6.0 // indirect + golang.org/x/mod v0.12.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/tools v0.12.0 // indirect + gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect ) diff --git a/go.sum b/go.sum index 18ae5f6..1e9fcbb 100644 --- a/go.sum +++ b/go.sum @@ -38,13 +38,15 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= 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= @@ -52,15 +54,11 @@ github.com/rhysd/go-fakeio v1.0.0 h1:+TjiKCOs32dONY7DaoVz/VPOdvRkPfBkEyUDIpM8FQY github.com/rhysd/go-fakeio v1.0.0/go.mod h1:joYxF906trVwp2JLrE4jlN7A0z6wrz8O6o1UjarbFzE= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= @@ -70,8 +68,8 @@ github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7Jul go.mongodb.org/mongo-driver v1.11.2 h1:+1v2rDQUWNcGW7/7E0Jvdz51V38XXxJfhzbV17aNHCw= go.mongodb.org/mongo-driver v1.11.2/go.mod h1:s7p5vEtfbeR1gYi6pnj3c3/urpbLv2T5Sfd6Rp2HBB8= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -83,20 +81,22 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss= +golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/katapult_test.go b/katapult_test.go index 813409e..b8f9801 100644 --- a/katapult_test.go +++ b/katapult_test.go @@ -7,7 +7,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "net/http" "net/http/httptest" "net/url" @@ -636,7 +635,7 @@ func TestClient_Do(t *testing.T) { } } - receivedReqBody, _ := ioutil.ReadAll(r.Body) + receivedReqBody, _ := io.ReadAll(r.Body) assert.Equal(t, tt.wantReq.body, string(receivedReqBody), ) @@ -712,7 +711,7 @@ func TestClient_Do(t *testing.T) { if tt.want != nil { if r, ok := tt.args.v.(io.Reader); ok { - b, err := ioutil.ReadAll(r) + b, err := io.ReadAll(r) require.NoError(t, err) assert.Equal(t, tt.want, string(b)) } else { diff --git a/request_test.go b/request_test.go index 2ad8c6d..9f4ea00 100644 --- a/request_test.go +++ b/request_test.go @@ -2,7 +2,7 @@ package katapult import ( "bytes" - "io/ioutil" + "io" "math" "net/url" "testing" @@ -227,7 +227,7 @@ func TestRequest_bodyContent(t *testing.T) { if tt.wantBody == nil { assert.Nil(t, body) } else { - b, err := ioutil.ReadAll(body) + b, err := io.ReadAll(body) require.NoError(t, err) assert.Equal(t, *tt.wantBody, string(b)) } diff --git a/tools/codegen/gen/errors.go b/tools/codegen/gen/errors.go index 351f463..6995bbd 100644 --- a/tools/codegen/gen/errors.go +++ b/tools/codegen/gen/errors.go @@ -3,8 +3,8 @@ package gen import ( "errors" "fmt" - "io/ioutil" "net/http" + "os" "path/filepath" "regexp" "sort" @@ -44,7 +44,7 @@ func (g *Generator) Errors() error { "size", hclog.Fmt("%d bytes", len(b)), ) //nolint:gosec - err = ioutil.WriteFile( + err = os.WriteFile( filepath.Join(outdir, "errors_generated.go"), b, 0o644, ) if err != nil { diff --git a/tools/codegen/main.go b/tools/codegen/main.go index 27ef604..0bb1a65 100644 --- a/tools/codegen/main.go +++ b/tools/codegen/main.go @@ -5,7 +5,7 @@ import ( "crypto/sha256" "flag" "fmt" - "io/ioutil" + "io" "log" "net/http" "os" @@ -219,7 +219,7 @@ func getSchema(name string, skipCache bool) (string, error) { } defer resp.Body.Close() - b, err := ioutil.ReadAll(resp.Body) + b, err := io.ReadAll(resp.Body) if err != nil { return "", err } @@ -229,7 +229,7 @@ func getSchema(name string, skipCache bool) (string, error) { "cache_file", tmpFile, "size", hclog.Fmt("%d bytes", len(b)), ) //nolint:gosec - err = ioutil.WriteFile(tmpFile, b, 0o644) + err = os.WriteFile(tmpFile, b, 0o644) if err != nil { return "", err } diff --git a/tools/schemafetcher/main.go b/tools/schemafetcher/main.go index e768fef..43952c5 100644 --- a/tools/schemafetcher/main.go +++ b/tools/schemafetcher/main.go @@ -6,7 +6,7 @@ import ( "encoding/json" "flag" "fmt" - "io/ioutil" + "io" "net/http" "os" "path/filepath" @@ -182,7 +182,7 @@ func mainE() error { } //nolint:gosec - err = ioutil.WriteFile(targetFile, buf.Bytes(), 0o644) + err = os.WriteFile(targetFile, buf.Bytes(), 0o644) if err != nil { return err } @@ -216,7 +216,7 @@ func getSchema(u string) ([]byte, error) { } defer resp.Body.Close() - b, err := ioutil.ReadAll(resp.Body) + b, err := io.ReadAll(resp.Body) if err != nil { return nil, err }