Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

sync: update CI config files #55

Merged
merged 5 commits into from
Sep 1, 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
8 changes: 4 additions & 4 deletions .github/workflows/go-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
env:
RUNGOGENERATE: false
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-go@v2
- uses: actions/setup-go@v3
with:
go-version: "1.18.x"
go-version: "1.19.x"
- name: Run repo-specific setup
uses: ./.github/actions/go-check-setup
if: hashFiles('./.github/actions/go-check-setup') != ''
Expand All @@ -27,7 +27,7 @@ jobs:
echo "RUNGOGENERATE=true" >> $GITHUB_ENV
fi
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@d7e217c1ff411395475b2971c0824e1e7cc1af98 # 2022.1 (v0.3.0)
run: go install honnef.co/go/tools/cmd/staticcheck@376210a89477dedbe6fdc4484b233998650d7b3c # 2022.1.3 (v0.3.3)
- name: Check that go.mod is tidy
uses: protocol/multiple-go-modules@v1.2
with:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ jobs:
fail-fast: false
matrix:
os: [ "ubuntu", "windows", "macos" ]
go: [ "1.17.x", "1.18.x" ]
go: [ "1.18.x", "1.19.x" ]
env:
COVERAGES: ""
runs-on: ${{ format('{0}-latest', matrix.os) }}
name: ${{ matrix.os }} (go ${{ matrix.go }})
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-go@v2
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: Go information
Expand All @@ -43,7 +43,7 @@ jobs:
# Use -coverpkg=./..., so that we include cross-package coverage.
# If package ./A imports ./B, and ./A's tests also cover ./B,
# this means ./B's coverage will be significantly higher than 0%.
run: go test -v -coverprofile=module-coverage.txt -coverpkg=./... ./...
run: go test -v -shuffle=on -coverprofile=module-coverage.txt -coverpkg=./... ./...
- name: Run tests (32 bit)
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
uses: protocol/multiple-go-modules@v1.2
Expand All @@ -52,7 +52,7 @@ jobs:
with:
run: |
export "PATH=${{ env.PATH_386 }}:$PATH"
go test -v ./...
go test -v -shuffle=on ./...
- name: Run tests with race detector
if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow
uses: protocol/multiple-go-modules@v1.2
Expand All @@ -62,7 +62,7 @@ jobs:
shell: bash
run: echo "COVERAGES=$(find . -type f -name 'module-coverage.txt' | tr -s '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV
- name: Upload coverage to Codecov
uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0
with:
files: '${{ env.COVERAGES }}'
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}
7 changes: 3 additions & 4 deletions filewriter_test.go
Original file line number Diff line number Diff line change
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 filewriter_unix.go
Original file line number Diff line number Diff line change
@@ -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 filewriter_unix_test.go
Original file line number Diff line number Diff line change
@@ -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 filewriter_windows.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build windows
// +build windows

package files

Expand Down
4 changes: 1 addition & 3 deletions filewriter_windows_test.go
Original file line number Diff line number Diff line change
@@ -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 filter_test.go
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ require (
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)

go 1.17
go 1.18
4 changes: 2 additions & 2 deletions helpers_test.go
Original file line number Diff line number Diff line change
@@ -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 is_hidden.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build !windows
// +build !windows

package files

Expand Down
1 change: 0 additions & 1 deletion is_hidden_windows.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build windows
// +build windows

package files

Expand Down
3 changes: 1 addition & 2 deletions multipartfile.go
Original file line number Diff line number Diff line change
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 readerfile.go
Original file line number Diff line number Diff line change
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 serialfile.go
Original file line number Diff line number Diff line change
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 serialfile_test.go
Original file line number Diff line number Diff line change
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 webfile_test.go
Original file line number Diff line number Diff line change
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