From e623d0a7d863f18cbd072eb48029f76b49ea9057 Mon Sep 17 00:00:00 2001 From: web3-bot Date: Mon, 29 Aug 2022 14:27:10 +0000 Subject: [PATCH 1/5] bump go.mod to Go 1.18 and run go fix --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index c4ff226..98e9832 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/ipfs/go-pinning-service-http-client -go 1.17 +go 1.18 require ( github.com/ipfs/go-cid v0.1.0 From 905bf818553964cd19e4194bcd502ed0d252312b Mon Sep 17 00:00:00 2001 From: web3-bot Date: Mon, 29 Aug 2022 14:27:13 +0000 Subject: [PATCH 2/5] stop using the deprecated io/ioutil package --- cmd/main.go | 5 +++-- model.go | 3 ++- openapi/api_pins.go | 45 ++++++++++++++++++++++++++------------------- openapi/client.go | 3 ++- 4 files changed, 33 insertions(+), 23 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index c095ed0..3136bbd 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -3,10 +3,11 @@ package main import ( "context" "fmt" - "github.com/ipfs/go-cid" - pinclient "github.com/ipfs/go-pinning-service-http-client" "os" "time" + + "github.com/ipfs/go-cid" + pinclient "github.com/ipfs/go-pinning-service-http-client" ) func main() { diff --git a/model.go b/model.go index 506c43a..a87f9c9 100644 --- a/model.go +++ b/model.go @@ -3,10 +3,11 @@ package go_pinning_service_http_client import ( "encoding/json" "fmt" + "time" + "github.com/ipfs/go-cid" "github.com/ipfs/go-pinning-service-http-client/openapi" "github.com/multiformats/go-multiaddr" - "time" ) // PinGetter Getter for Pin object diff --git a/openapi/api_pins.go b/openapi/api_pins.go index 8c45df5..341abfd 100644 --- a/openapi/api_pins.go +++ b/openapi/api_pins.go @@ -11,7 +11,6 @@ package openapi import ( _context "context" - _ioutil "io/ioutil" _nethttp "net/http" _neturl "net/url" "strings" @@ -76,7 +75,8 @@ func (r apiPinsGetRequest) Meta(meta map[string]string) apiPinsGetRequest { /* PinsGet List pin objects List all the pin objects, matching optional filters; when no filter is provided, only successful pins are returned - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return apiPinsGetRequest */ func (a *PinsApiService) PinsGet(ctx _context.Context) apiPinsGetRequest { @@ -88,7 +88,8 @@ func (a *PinsApiService) PinsGet(ctx _context.Context) apiPinsGetRequest { /* Execute executes the request - @return PinResults + + @return PinResults */ func (r apiPinsGetRequest) Execute() (PinResults, *_nethttp.Response, error) { var ( @@ -159,7 +160,7 @@ func (r apiPinsGetRequest) Execute() (PinResults, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, err } - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarBody, err := _io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHTTPResponse, err @@ -209,7 +210,8 @@ func (r apiPinsPostRequest) Pin(pin Pin) apiPinsPostRequest { /* PinsPost Add pin object Add a new pin object for the current access token - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return apiPinsPostRequest */ func (a *PinsApiService) PinsPost(ctx _context.Context) apiPinsPostRequest { @@ -221,7 +223,8 @@ func (a *PinsApiService) PinsPost(ctx _context.Context) apiPinsPostRequest { /* Execute executes the request - @return PinStatus + + @return PinStatus */ func (r apiPinsPostRequest) Execute() (PinStatus, *_nethttp.Response, error) { var ( @@ -277,7 +280,7 @@ func (r apiPinsPostRequest) Execute() (PinStatus, *_nethttp.Response, error) { return localVarReturnValue, localVarHTTPResponse, err } - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarBody, err := _io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHTTPResponse, err @@ -322,8 +325,9 @@ type apiPinsRequestidDeleteRequest struct { /* PinsRequestidDelete Remove pin object Remove a pin object - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param requestid + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param requestid + @return apiPinsRequestidDeleteRequest */ func (a *PinsApiService) PinsRequestidDelete(ctx _context.Context, requestid string) apiPinsRequestidDeleteRequest { @@ -336,7 +340,6 @@ func (a *PinsApiService) PinsRequestidDelete(ctx _context.Context, requestid str /* Execute executes the request - */ func (r apiPinsRequestidDeleteRequest) Execute() (*_nethttp.Response, error) { var ( @@ -386,7 +389,7 @@ func (r apiPinsRequestidDeleteRequest) Execute() (*_nethttp.Response, error) { return localVarHTTPResponse, err } - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarBody, err := _io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() if err != nil { return localVarHTTPResponse, err @@ -422,8 +425,9 @@ type apiPinsRequestidGetRequest struct { /* PinsRequestidGet Get pin object Get a pin object and its status - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param requestid + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param requestid + @return apiPinsRequestidGetRequest */ func (a *PinsApiService) PinsRequestidGet(ctx _context.Context, requestid string) apiPinsRequestidGetRequest { @@ -436,7 +440,8 @@ func (a *PinsApiService) PinsRequestidGet(ctx _context.Context, requestid string /* Execute executes the request - @return PinStatus + + @return PinStatus */ func (r apiPinsRequestidGetRequest) Execute() (PinStatus, *_nethttp.Response, error) { var ( @@ -487,7 +492,7 @@ func (r apiPinsRequestidGetRequest) Execute() (PinStatus, *_nethttp.Response, er return localVarReturnValue, localVarHTTPResponse, err } - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarBody, err := _io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHTTPResponse, err @@ -538,8 +543,9 @@ func (r apiPinsRequestidPostRequest) Pin(pin Pin) apiPinsRequestidPostRequest { /* PinsRequestidPost Replace pin object Replace an existing pin object (shortcut for executing remove and add operations in one step to avoid unnecessary garbage collection of blocks present in both recursive pins) - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param requestid + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param requestid + @return apiPinsRequestidPostRequest */ func (a *PinsApiService) PinsRequestidPost(ctx _context.Context, requestid string) apiPinsRequestidPostRequest { @@ -552,7 +558,8 @@ func (a *PinsApiService) PinsRequestidPost(ctx _context.Context, requestid strin /* Execute executes the request - @return PinStatus + + @return PinStatus */ func (r apiPinsRequestidPostRequest) Execute() (PinStatus, *_nethttp.Response, error) { var ( @@ -609,7 +616,7 @@ func (r apiPinsRequestidPostRequest) Execute() (PinStatus, *_nethttp.Response, e return localVarReturnValue, localVarHTTPResponse, err } - localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarBody, err := _io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHTTPResponse, err diff --git a/openapi/client.go b/openapi/client.go index 029d1cd..a0fc90e 100644 --- a/openapi/client.go +++ b/openapi/client.go @@ -16,7 +16,6 @@ import ( "encoding/xml" "errors" "fmt" - "golang.org/x/oauth2" "io" "log" "mime/multipart" @@ -29,6 +28,8 @@ import ( "regexp" "strings" "time" + + "golang.org/x/oauth2" ) var ( From 5a01eecf611c4d9545887331106cbf7606629b0d Mon Sep 17 00:00:00 2001 From: web3-bot Date: Mon, 29 Aug 2022 14:27:14 +0000 Subject: [PATCH 3/5] update .github/workflows/go-test.yml --- .github/workflows/go-test.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml index b86241a..8a1697b 100644 --- a/.github/workflows/go-test.yml +++ b/.github/workflows/go-test.yml @@ -10,16 +10,16 @@ jobs: fail-fast: false matrix: os: [ "ubuntu", "windows", "macos" ] - go: [ "1.17.x", "1.18.x" ] + go: [ "1.18.x", "1.19.x" ] env: COVERAGES: "" runs-on: ${{ format('{0}-latest', matrix.os) }} name: ${{ matrix.os }} (go ${{ matrix.go }}) steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: recursive - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v3 with: go-version: ${{ matrix.go }} - name: Go information @@ -43,7 +43,7 @@ jobs: # Use -coverpkg=./..., so that we include cross-package coverage. # If package ./A imports ./B, and ./A's tests also cover ./B, # this means ./B's coverage will be significantly higher than 0%. - run: go test -v -coverprofile=module-coverage.txt -coverpkg=./... ./... + run: go test -v -shuffle=on -coverprofile=module-coverage.txt -coverpkg=./... ./... - name: Run tests (32 bit) if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX. uses: protocol/multiple-go-modules@v1.2 @@ -52,7 +52,7 @@ jobs: with: run: | export "PATH=${{ env.PATH_386 }}:$PATH" - go test -v ./... + go test -v -shuffle=on ./... - name: Run tests with race detector if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow uses: protocol/multiple-go-modules@v1.2 @@ -62,7 +62,7 @@ jobs: shell: bash run: echo "COVERAGES=$(find . -type f -name 'module-coverage.txt' | tr -s '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV - name: Upload coverage to Codecov - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 + uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 with: files: '${{ env.COVERAGES }}' env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }} From 2f213bd345a19f1ecf5ab4142ba59f94deca8383 Mon Sep 17 00:00:00 2001 From: web3-bot Date: Mon, 29 Aug 2022 14:27:14 +0000 Subject: [PATCH 4/5] update .github/workflows/go-check.yml --- .github/workflows/go-check.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/go-check.yml b/.github/workflows/go-check.yml index 25e1afd..251f7fa 100644 --- a/.github/workflows/go-check.yml +++ b/.github/workflows/go-check.yml @@ -11,12 +11,12 @@ jobs: env: RUNGOGENERATE: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: recursive - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v3 with: - go-version: "1.18.x" + go-version: "1.19.x" - name: Run repo-specific setup uses: ./.github/actions/go-check-setup if: hashFiles('./.github/actions/go-check-setup') != '' @@ -27,7 +27,7 @@ jobs: echo "RUNGOGENERATE=true" >> $GITHUB_ENV fi - name: Install staticcheck - run: go install honnef.co/go/tools/cmd/staticcheck@d7e217c1ff411395475b2971c0824e1e7cc1af98 # 2022.1 (v0.3.0) + run: go install honnef.co/go/tools/cmd/staticcheck@376210a89477dedbe6fdc4484b233998650d7b3c # 2022.1.3 (v0.3.3) - name: Check that go.mod is tidy uses: protocol/multiple-go-modules@v1.2 with: From 61e9e65db4dbcbfa78fc94230694760219135f66 Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 31 Aug 2022 22:36:30 +0200 Subject: [PATCH 5/5] fix: import io as _io --- openapi/api_pins.go | 1 + 1 file changed, 1 insertion(+) diff --git a/openapi/api_pins.go b/openapi/api_pins.go index 341abfd..b2858c5 100644 --- a/openapi/api_pins.go +++ b/openapi/api_pins.go @@ -11,6 +11,7 @@ package openapi import ( _context "context" + _io "io" _nethttp "net/http" _neturl "net/url" "strings"