Replace deprecated ioutil with io and os (#20776)

* Replace ioutil with io and os

* Replace ioutil in utils/file.go

* Minor fix to tests and excluded files

Co-authored-by: Tim Scheuermann <tim.scheuermann@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Tim Scheuermann
2022-08-09 14:25:46 +03:00
коммит произвёл GitHub
родитель 15b6046a62
Коммит b4570afa90
115 изменённых файлов: 408 добавлений и 475 удалений

Просмотреть файл

@@ -9,7 +9,7 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"os"
@@ -108,7 +108,7 @@ func makeTelemetryServiceAndReceiver(t *testing.T, cloudLicense bool) (*Telemetr
pchan := make(chan testTelemetryPayload, 100)
receiver := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
body, err := ioutil.ReadAll(r.Body)
body, err := io.ReadAll(r.Body)
require.NoError(t, err)
var p testTelemetryPayload
@@ -154,8 +154,8 @@ func initializeMocks(cfg *model.Config, cloudLicense bool) (*mocks.ServerIface,
serverIfaceMock.On("Config").Return(cfg)
serverIfaceMock.On("IsLeader").Return(true)
pluginDir, _ := ioutil.TempDir("", "")
webappPluginDir, _ := ioutil.TempDir("", "")
pluginDir, _ := os.MkdirTemp("", "")
webappPluginDir, _ := os.MkdirTemp("", "")
cleanUp := func() {
os.RemoveAll(pluginDir)
os.RemoveAll(webappPluginDir)