-
Notifications
You must be signed in to change notification settings - Fork 16
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
Remove references to io/ioutil package #45
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,16 +4,19 @@ on: | |
tags: | ||
- 'v*' | ||
- 'test-action-release-*' | ||
|
||
env: | ||
GO111MODULE: on | ||
GO_VERSION: 1.20.x | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to define env |
||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 20 | ||
steps: | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19.x | ||
go-version: ${{ env.GO_VERSION }} | ||
- uses: actions/checkout@v3 | ||
with: | ||
path: go/src/github.com/containerd/fuse-overlayfs-snapshotter | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
linters: | ||
enable: | ||
- depguard | ||
- exportloopref | ||
- gofmt | ||
- gosec | ||
- ineffassign | ||
- misspell | ||
- nolintlint | ||
- revive | ||
- staticcheck | ||
- tenv | ||
- unconvert | ||
- unused | ||
- vet | ||
disable: | ||
- errcheck | ||
|
||
linters-settings: | ||
depguard: | ||
list-type: denylist | ||
include-go-root: true | ||
packages: | ||
# use "io" or "os" instead | ||
# https://go.dev/doc/go1.16#ioutil | ||
- io/ioutil |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,6 @@ package fuseoverlayfs | |
import ( | ||
"context" | ||
"fmt" | ||
"io/ioutil" | ||
"os" | ||
"path/filepath" | ||
"strings" | ||
|
@@ -182,9 +181,12 @@ func (o *snapshotter) Mounts(ctx context.Context, key string) ([]mount.Mount, er | |
if err != nil { | ||
return nil, err | ||
} | ||
defer t.Rollback() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved just for readability / matches the standard practice of other functions in this snapshotter. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be another PR |
||
s, err := storage.GetSnapshot(ctx, key) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to get snapshot %s from storage: %w", key, err) | ||
} | ||
Comment on lines
+186
to
+188
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolves ineffectual assignment of err. If |
||
_, info, _, err := storage.GetInfo(ctx, key) | ||
t.Rollback() | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to get active mount: %w", err) | ||
} | ||
|
@@ -414,7 +416,7 @@ func (o *snapshotter) createSnapshot(ctx context.Context, kind snapshots.Kind, k | |
} | ||
|
||
func (o *snapshotter) prepareDirectory(ctx context.Context, snapshotDir string, kind snapshots.Kind) (string, error) { | ||
td, err := ioutil.TempDir(snapshotDir, "new-") | ||
td, err := os.MkdirTemp(snapshotDir, "new-") | ||
if err != nil { | ||
return "", fmt.Errorf("failed to create temp dir: %w", err) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to define env