From 5454b5a08c7914e79a1fca70937c7349a28e9257 Mon Sep 17 00:00:00 2001 From: LuitelSamikshya Date: Tue, 1 Nov 2022 13:11:23 -0500 Subject: [PATCH] updated github actions --- .github/workflows/build-test.yml | 2 +- .github/workflows/lint-test.yml | 7 +++++-- go.mod | 2 +- pkg/chaos/chaos.go | 11 +++++------ 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 1281c3a..ddfe8e7 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/setup-go@v3 with: - go-version: 1.17 + go-version: 1.18 - name: Test run: go test ./... diff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.yml index 03cbc1b..36c2b36 100644 --- a/.github/workflows/lint-test.yml +++ b/.github/workflows/lint-test.yml @@ -11,10 +11,13 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 - + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.18 - name: Run golangci-lint uses: golangci/golangci-lint-action@v3.3.0 with: version: latest args: --timeout 5m - working-directory: . \ No newline at end of file + working-directory: . diff --git a/go.mod b/go.mod index 97c1ec7..6ea1a22 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/projectdiscovery/chaos-client -go 1.17 +go 1.18 require ( github.com/json-iterator/go v1.1.12 diff --git a/pkg/chaos/chaos.go b/pkg/chaos/chaos.go index 6bcf0fd..19fe7c3 100644 --- a/pkg/chaos/chaos.go +++ b/pkg/chaos/chaos.go @@ -5,7 +5,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "strings" @@ -51,7 +50,7 @@ func (c *Client) GetStatistics(req *GetStatisticsRequest) (*GetStatisticsRespons } if resp.StatusCode != http.StatusOK { - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return nil, errors.Wrap(err, "could not read response.") } @@ -102,7 +101,7 @@ func (c *Client) GetSubdomains(req *SubdomainsRequest) chan *Result { } if resp.StatusCode != http.StatusOK { - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { results <- &Result{Error: errors.Wrap(err, "could not read response.")} return @@ -195,7 +194,7 @@ func (c *Client) GetBBQSubdomains(req *SubdomainsRequest) chan *BBQResult { } if resp.StatusCode != http.StatusOK { - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { results <- &BBQResult{Error: errors.Wrap(err, "could not read response.")} return @@ -247,13 +246,13 @@ func (c *Client) PutSubdomains(req *PutSubdomainsRequest) (*PutSubdomainsRespons defer resp.Body.Close() if resp.StatusCode != http.StatusOK { - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return nil, errors.Wrap(err, "could not read response.") } return nil, InvalidStatusCodeError{StatusCode: resp.StatusCode, Message: body} } - _, _ = io.Copy(ioutil.Discard, resp.Body) + _, _ = io.Copy(io.Discard, resp.Body) return &PutSubdomainsResponse{}, nil }