Skip to content

Commit

Permalink
Merge pull request #115 from projectdiscovery/issue-114/update-github…
Browse files Browse the repository at this point in the history
…-actions

updated github actions
  • Loading branch information
Mzack9999 committed Nov 2, 2022
2 parents fac3784 + 5454b5a commit efae849
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Expand Up @@ -15,7 +15,7 @@ jobs:

- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version: 1.18

- name: Test
run: go test ./...
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/lint-test.yml
Expand Up @@ -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: .
working-directory: .
2 changes: 1 addition & 1 deletion 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
Expand Down
11 changes: 5 additions & 6 deletions pkg/chaos/chaos.go
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"strings"

Expand Down Expand Up @@ -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.")
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit efae849

Please sign in to comment.