Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for go 1.19 #2563

Merged
merged 2 commits into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions devtools/gettool/fetchfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
)
Expand All @@ -19,7 +18,7 @@ func fetchFile(url string) (*os.File, int64, error) {
return nil, 0, fmt.Errorf("non-200 response: %s", resp.Status)
}

fd, err := ioutil.TempFile("", "*.zip")
fd, err := os.CreateTemp("", "*.zip")
if err != nil {
return nil, 0, fmt.Errorf("create temp file: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions grafana/grafana.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"strings"
"text/template"
Expand Down Expand Up @@ -182,7 +182,7 @@ func GrafanaToEventsAPI(aDB *alert.Store, intDB *integrationkey.Store) http.Hand
}
serviceID := permission.ServiceID(ctx)

data, err := ioutil.ReadAll(r.Body)
data, err := io.ReadAll(r.Body)
if errutil.HTTPError(ctx, w, err) {
return
}
Expand Down
12 changes: 6 additions & 6 deletions notification/twilio/twiml_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package twilio

import (
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"testing"
Expand All @@ -20,7 +20,7 @@ func TestTwiMLResponse(t *testing.T) {
resp := rec.Result()
assert.Equal(t, http.StatusOK, resp.StatusCode)
assert.Contains(t, resp.Header.Get("Content-Type"), "application/xml")
data, err := ioutil.ReadAll(resp.Body)
data, err := io.ReadAll(resp.Body)
assert.NoError(t, err)
assert.Equal(t, `<?xml version="1.0" encoding="UTF-8"?>
<Response>
Expand All @@ -41,7 +41,7 @@ func TestTwiMLResponse(t *testing.T) {
resp := rec.Result()
assert.Equal(t, http.StatusOK, resp.StatusCode)
assert.Contains(t, resp.Header.Get("Content-Type"), "application/xml")
data, err := ioutil.ReadAll(resp.Body)
data, err := io.ReadAll(resp.Body)
assert.NoError(t, err)
assert.Equal(t, `<?xml version="1.0" encoding="UTF-8"?>
<Response>
Expand All @@ -61,7 +61,7 @@ func TestTwiMLResponse(t *testing.T) {
resp := rec.Result()
assert.Equal(t, http.StatusOK, resp.StatusCode)
assert.Contains(t, resp.Header.Get("Content-Type"), "application/xml")
data, err := ioutil.ReadAll(resp.Body)
data, err := io.ReadAll(resp.Body)
assert.NoError(t, err)
assert.Equal(t, `<?xml version="1.0" encoding="UTF-8"?>
<Response>
Expand All @@ -83,7 +83,7 @@ func TestTwiMLResponse(t *testing.T) {
resp := rec.Result()
assert.Equal(t, http.StatusOK, resp.StatusCode)
assert.Contains(t, resp.Header.Get("Content-Type"), "application/xml")
data, err := ioutil.ReadAll(resp.Body)
data, err := io.ReadAll(resp.Body)
assert.NoError(t, err)
assert.Equal(t, `<?xml version="1.0" encoding="UTF-8"?>
<Response>
Expand All @@ -108,7 +108,7 @@ func TestTwiMLResponse(t *testing.T) {
resp := rec.Result()
assert.Equal(t, http.StatusOK, resp.StatusCode)
assert.Contains(t, resp.Header.Get("Content-Type"), "application/xml")
data, err := ioutil.ReadAll(resp.Body)
data, err := io.ReadAll(resp.Body)
assert.NoError(t, err)
assert.Equal(t, `<?xml version="1.0" encoding="UTF-8"?>
<Response>
Expand Down
6 changes: 3 additions & 3 deletions smoketest/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package smoketest

import (
"encoding/json"
"github.com/stretchr/testify/require"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/target/goalert/smoketest/harness"
)

Expand All @@ -27,7 +27,7 @@ func TestWebhookAlert(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
var alert WebhookTestingAlert

data, err := ioutil.ReadAll(r.Body)
data, err := io.ReadAll(r.Body)
require.Nil(t, err)

err = json.Unmarshal(data, &alert)
Expand Down