Skip to content

Commit

Permalink
Merge pull request ipfs/go-ipfs-files#55 from ipfs/web3-bot/sync
Browse files Browse the repository at this point in the history
sync: update CI config files

This commit was moved from ipfs/go-ipfs-files@30b08ca
  • Loading branch information
galargh committed Sep 1, 2022
2 parents 7418db2 + e6e3c80 commit 49b8249
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 34 deletions.
7 changes: 3 additions & 4 deletions files/filewriter_test.go
Expand Up @@ -2,7 +2,6 @@ package files

import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand All @@ -20,7 +19,7 @@ func TestWriteTo(t *testing.T) {
"a": NewBytesFile([]byte("foobar")),
}),
})
tmppath, err := ioutil.TempDir("", "files-test")
tmppath, err := os.MkdirTemp("", "files-test")
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -60,7 +59,7 @@ func TestWriteTo(t *testing.T) {
return fmt.Errorf("expected a directory at %q", rpath)
}
} else {
actual, err := ioutil.ReadFile(cpath)
actual, err := os.ReadFile(cpath)
if err != nil {
return err
}
Expand All @@ -79,7 +78,7 @@ func TestWriteTo(t *testing.T) {
}

func TestDontAllowOverwrite(t *testing.T) {
tmppath, err := ioutil.TempDir("", "files-test")
tmppath, err := os.MkdirTemp("", "files-test")
assert.NoError(t, err)
defer os.RemoveAll(tmppath)

Expand Down
1 change: 0 additions & 1 deletion files/filewriter_unix.go
@@ -1,5 +1,4 @@
//go:build darwin || linux || netbsd || openbsd || freebsd || dragonfly
// +build darwin linux netbsd openbsd freebsd dragonfly

package files

Expand Down
4 changes: 1 addition & 3 deletions files/filewriter_unix_test.go
@@ -1,10 +1,8 @@
//go:build darwin || linux || netbsd || openbsd
// +build darwin linux netbsd openbsd

package files

import (
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand All @@ -13,7 +11,7 @@ import (
)

func TestWriteToInvalidPaths(t *testing.T) {
tmppath, err := ioutil.TempDir("", "files-test")
tmppath, err := os.MkdirTemp("", "files-test")
assert.NoError(t, err)
defer os.RemoveAll(tmppath)

Expand Down
1 change: 0 additions & 1 deletion files/filewriter_windows.go
@@ -1,5 +1,4 @@
//go:build windows
// +build windows

package files

Expand Down
4 changes: 1 addition & 3 deletions files/filewriter_windows_test.go
@@ -1,10 +1,8 @@
//go:build windows
// +build windows

package files

import (
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand All @@ -13,7 +11,7 @@ import (
)

func TestWriteToInvalidPaths(t *testing.T) {
tmppath, err := ioutil.TempDir("", "files-test")
tmppath, err := os.MkdirTemp("", "files-test")
assert.NoError(t, err)
defer os.RemoveAll(tmppath)

Expand Down
5 changes: 2 additions & 3 deletions files/filter_test.go
@@ -1,7 +1,6 @@
package files

import (
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -35,13 +34,13 @@ func TestFileFilter(t *testing.T) {
if err == nil {
t.Errorf("creating a filter without an invalid ignore file path should have failed")
}
tmppath, err := ioutil.TempDir("", "filter-test")
tmppath, err := os.MkdirTemp("", "filter-test")
if err != nil {
t.Fatal(err)
}
ignoreFilePath := filepath.Join(tmppath, "ignoreFile")
ignoreFileContents := []byte("a.txt")
if err := ioutil.WriteFile(ignoreFilePath, ignoreFileContents, 0666); err != nil {
if err := os.WriteFile(ignoreFilePath, ignoreFileContents, 0666); err != nil {
t.Fatal(err)
}
filterWithIgnoreFile, err := NewFilter(ignoreFilePath, nil, false)
Expand Down
4 changes: 2 additions & 2 deletions files/helpers_test.go
@@ -1,7 +1,7 @@
package files

import (
"io/ioutil"
"io"
"testing"
)

Expand Down Expand Up @@ -56,7 +56,7 @@ func CheckDir(t *testing.T, dir Directory, expected []Event) {
if !ok {
t.Fatalf("[%d] expected file to be a normal file: %T", i, it.Node())
}
out, err := ioutil.ReadAll(mf)
out, err := io.ReadAll(mf)
if err != nil {
t.Errorf("[%d] failed to read file", i)
continue
Expand Down
1 change: 0 additions & 1 deletion files/is_hidden.go
@@ -1,5 +1,4 @@
//go:build !windows
// +build !windows

package files

Expand Down
1 change: 0 additions & 1 deletion files/is_hidden_windows.go
@@ -1,5 +1,4 @@
//go:build windows
// +build windows

package files

Expand Down
3 changes: 1 addition & 2 deletions files/multipartfile.go
Expand Up @@ -2,7 +2,6 @@ package files

import (
"io"
"io/ioutil"
"mime"
"mime/multipart"
"net/url"
Expand Down Expand Up @@ -94,7 +93,7 @@ func (w *multipartWalker) nextFile() (Node, error) {
walker: w,
}, nil
case applicationSymlink:
out, err := ioutil.ReadAll(part)
out, err := io.ReadAll(part)
if err != nil {
return nil, err
}
Expand Down
3 changes: 1 addition & 2 deletions files/readerfile.go
Expand Up @@ -3,7 +3,6 @@ package files
import (
"bytes"
"io"
"io/ioutil"
"os"
"path/filepath"
)
Expand All @@ -29,7 +28,7 @@ func NewReaderFile(reader io.Reader) File {
func NewReaderStatFile(reader io.Reader, stat os.FileInfo) File {
rc, ok := reader.(io.ReadCloser)
if !ok {
rc = ioutil.NopCloser(reader)
rc = io.NopCloser(reader)
}

return &ReaderFile{"", rc, stat, -1}
Expand Down
12 changes: 10 additions & 2 deletions files/serialfile.go
Expand Up @@ -3,7 +3,7 @@ package files
import (
"errors"
"fmt"
"io/ioutil"
"io/fs"
"os"
"path/filepath"
)
Expand Down Expand Up @@ -52,10 +52,18 @@ func NewSerialFileWithFilter(path string, filter *Filter, stat os.FileInfo) (Nod
case mode.IsDir():
// for directories, stat all of the contents first, so we know what files to
// open when Entries() is called
contents, err := ioutil.ReadDir(path)
entries, err := os.ReadDir(path)
if err != nil {
return nil, err
}
contents := make([]fs.FileInfo, 0, len(entries))
for _, entry := range entries {
content, err := entry.Info()
if err != nil {
return nil, err
}
contents = append(contents, content)
}
return &serialFile{path, contents, stat, filter}, nil
case mode&os.ModeSymlink != 0:
target, err := os.Readlink(path)
Expand Down
8 changes: 4 additions & 4 deletions files/serialfile_test.go
Expand Up @@ -2,7 +2,7 @@ package files

import (
"fmt"
"io/ioutil"
"io"
"os"
"path/filepath"
"sort"
Expand All @@ -22,7 +22,7 @@ func TestSerialFile(t *testing.T) {
}

func testSerialFile(t *testing.T, hidden, withIgnoreRules bool) {
tmppath, err := ioutil.TempDir("", "files-test")
tmppath, err := os.MkdirTemp("", "files-test")
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -67,7 +67,7 @@ func testSerialFile(t *testing.T, hidden, withIgnoreRules bool) {
if c == "" {
continue
}
if err := ioutil.WriteFile(path, []byte(c), 0666); err != nil {
if err := os.WriteFile(path, []byte(c), 0666); err != nil {
t.Fatal(err)
}
}
Expand Down Expand Up @@ -158,7 +158,7 @@ testInputs:
return fmt.Errorf("expected a directory at %q", path)
}
case File:
actual, err := ioutil.ReadAll(nd)
actual, err := io.ReadAll(nd)
if err != nil {
return err
}
Expand Down
10 changes: 5 additions & 5 deletions files/webfile_test.go
Expand Up @@ -2,7 +2,7 @@ package files

import (
"fmt"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"net/url"
Expand All @@ -21,7 +21,7 @@ func TestWebFile(t *testing.T) {
t.Fatal(err)
}
wf := NewWebFile(u)
body, err := ioutil.ReadAll(wf)
body, err := io.ReadAll(wf)
if err != nil {
t.Fatal(err)
}
Expand All @@ -41,7 +41,7 @@ func TestWebFile_notFound(t *testing.T) {
t.Fatal(err)
}
wf := NewWebFile(u)
_, err = ioutil.ReadAll(wf)
_, err = io.ReadAll(wf)
if err == nil {
t.Fatal("expected error")
}
Expand All @@ -68,7 +68,7 @@ func TestWebFileSize(t *testing.T) {
t.Errorf("expected size to be %d, got %d", len(body), size)
}

actual, err := ioutil.ReadAll(wf1)
actual, err := io.ReadAll(wf1)
if err != nil {
t.Fatal(err)
}
Expand All @@ -81,7 +81,7 @@ func TestWebFileSize(t *testing.T) {
// Read size after reading file.

wf2 := NewWebFile(u)
actual, err = ioutil.ReadAll(wf2)
actual, err = io.ReadAll(wf2)
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 49b8249

Please sign in to comment.