Skip to content

sync: update CI config files #195

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

Merged
merged 6 commits into from
Aug 31, 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/[email protected]
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/[email protected]
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/[email protected]
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 }}
4 changes: 2 additions & 2 deletions basic_ds_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package datastore_test

import (
"io/ioutil"
"io"
"log"
"testing"

Expand All @@ -16,7 +16,7 @@ func TestMapDatastore(t *testing.T) {

func TestLogDatastore(t *testing.T) {
defer log.SetOutput(log.Writer())
log.SetOutput(ioutil.Discard)
log.SetOutput(io.Discard)
ds := datastore.NewLogDatastore(datastore.NewMapDatastore(), "")
dstest.SubtestAll(t, ds)
}
12 changes: 6 additions & 6 deletions datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ var ErrNotFound error = &dsError{error: errors.New("datastore: key not found"),
// GetBackedHas provides a default Datastore.Has implementation.
// It exists so Datastore.Has implementations can use it, like so:
//
// func (*d SomeDatastore) Has(key Key) (exists bool, err error) {
// return GetBackedHas(d, key)
// }
// func (*d SomeDatastore) Has(key Key) (exists bool, err error) {
// return GetBackedHas(d, key)
// }
func GetBackedHas(ctx context.Context, ds Read, key Key) (bool, error) {
_, err := ds.Get(ctx, key)
switch err {
Expand All @@ -219,9 +219,9 @@ func GetBackedHas(ctx context.Context, ds Read, key Key) (bool, error) {
// GetBackedSize provides a default Datastore.GetSize implementation.
// It exists so Datastore.GetSize implementations can use it, like so:
//
// func (*d SomeDatastore) GetSize(key Key) (size int, err error) {
// return GetBackedSize(d, key)
// }
// func (*d SomeDatastore) GetSize(key Key) (size int, err error) {
// return GetBackedSize(d, key)
// }
func GetBackedSize(ctx context.Context, ds Read, key Key) (int, error) {
value, err := ds.Get(ctx, key)
if err == nil {
Expand Down
11 changes: 5 additions & 6 deletions examples/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
// This means key some segments will not work. For example, the
// following keys will result in unwanted behavior:
//
// - "/foo/./bar"
// - "/foo/../bar"
// - "/foo\x00bar"
// - "/foo/./bar"
// - "/foo/../bar"
// - "/foo\x00bar"
//
// Keys that only differ in case may be confused with each other on
// case insensitive file systems, for example in OS X.
Expand All @@ -20,7 +20,6 @@ package examples
import (
"context"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
Expand Down Expand Up @@ -65,7 +64,7 @@ func (d *Datastore) Put(ctx context.Context, key ds.Key, value []byte) (err erro
return err
}

return ioutil.WriteFile(fn, value, 0666)
return os.WriteFile(fn, value, 0666)
}

// Sync would ensure that any previous Puts under the prefix are written to disk.
Expand All @@ -81,7 +80,7 @@ func (d *Datastore) Get(ctx context.Context, key ds.Key) (value []byte, err erro
return nil, ds.ErrNotFound
}

return ioutil.ReadFile(fn)
return os.ReadFile(fn)
}

// Has returns whether the datastore has a value for a given key
Expand Down
2 changes: 1 addition & 1 deletion failstore/failstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (d *Failstore) DiskUsage(ctx context.Context) (uint64, error) {
return ds.DiskUsage(ctx, d.child)
}

// Close implements the Datastore interface
// Close implements the Datastore interface
func (d *Failstore) Close() error {
return d.child.Close()
}
Expand Down
6 changes: 3 additions & 3 deletions fuzz/cmd/compare/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"fmt"
"io/ioutil"
"io"
"os"

ds "github.com/ipfs/go-datastore"
Expand All @@ -28,9 +28,9 @@ func main() {
var dat []byte
var err error
if *input == "" {
dat, err = ioutil.ReadAll(os.Stdin)
dat, err = io.ReadAll(os.Stdin)
} else {
dat, err = ioutil.ReadFile(*input)
dat, err = os.ReadFile(*input)
}
if err != nil {
fmt.Fprintf(os.Stderr, "Could not read %s: %v\n", *input, err)
Expand Down
6 changes: 3 additions & 3 deletions fuzz/cmd/isprefix/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package main

import (
"fmt"
"io/ioutil"
"io"
"os"

ds "github.com/ipfs/go-datastore"
Expand Down Expand Up @@ -47,9 +47,9 @@ func main() {
var dat []byte
var err error
if *input == "" {
dat, err = ioutil.ReadAll(os.Stdin)
dat, err = io.ReadAll(os.Stdin)
} else {
dat, err = ioutil.ReadFile(*input)
dat, err = os.ReadFile(*input)
}
if err != nil {
fmt.Fprintf(os.Stderr, "could not read %s: %v\n", *input, err)
Expand Down
3 changes: 1 addition & 2 deletions fuzz/cmd/run/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"bufio"
"fmt"
"io/ioutil"
"os"

fuzzer "github.com/ipfs/go-datastore/fuzz"
Expand All @@ -22,7 +21,7 @@ func main() {
fuzzer.Threads = *threads

if *input != "" {
dat, err := ioutil.ReadFile(*input)
dat, err := os.ReadFile(*input)
if err != nil {
fmt.Fprintf(os.Stderr, "could not read %s: %v\n", *input, err)
os.Exit(1)
Expand Down
3 changes: 1 addition & 2 deletions fuzz/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"os"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -134,7 +133,7 @@ func Fuzz(data []byte) int {
impls = append(impls, impl)
}

defaultLoc, _ := ioutil.TempDir("", "fuzz-*")
defaultLoc, _ := os.MkdirTemp("", "fuzz-*")

if len(impls) == 0 {
fmt.Fprintf(os.Stderr, "No datastores to fuzz.\n")
Expand Down
2 changes: 1 addition & 1 deletion fuzz/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/ipfs/go-datastore/fuzz

go 1.17
go 1.18

require (
github.com/ipfs/go-datastore v0.4.4
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ require (
go.uber.org/atomic v1.6.0 // indirect
)

go 1.17
go 1.18
Loading