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>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
15b6046a62
Коммит
b4570afa90
@@ -5,7 +5,6 @@ package plugin
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
@@ -16,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestAvailablePlugins(t *testing.T) {
|
||||
dir, err1 := ioutil.TempDir("", "mm-plugin-test")
|
||||
dir, err1 := os.MkdirTemp("", "mm-plugin-test")
|
||||
require.NoError(t, err1)
|
||||
t.Cleanup(func() {
|
||||
os.RemoveAll(dir)
|
||||
@@ -40,7 +39,7 @@ func TestAvailablePlugins(t *testing.T) {
|
||||
path := filepath.Join(dir, "plugin1", "plugin.json")
|
||||
manifestJSON, jsonErr := json.Marshal(bundle1.Manifest)
|
||||
require.NoError(t, jsonErr)
|
||||
err = ioutil.WriteFile(path, manifestJSON, 0644)
|
||||
err = os.WriteFile(path, manifestJSON, 0644)
|
||||
require.NoError(t, err)
|
||||
|
||||
bundles, err := env.Available()
|
||||
@@ -54,7 +53,7 @@ func TestAvailablePlugins(t *testing.T) {
|
||||
defer os.RemoveAll(filepath.Join(dir, "plugin2"))
|
||||
|
||||
path := filepath.Join(dir, "plugin2", "manifest.json")
|
||||
err = ioutil.WriteFile(path, []byte("{}"), 0644)
|
||||
err = os.WriteFile(path, []byte("{}"), 0644)
|
||||
require.NoError(t, err)
|
||||
|
||||
bundles, err := env.Available()
|
||||
|
||||
Ссылка в новой задаче
Block a user