mirror of
https://github.com/rclone/rclone.git
synced 2025-12-06 00:03:32 +00:00
build: enable all govet checks (except fieldalignment and shadow) and fix issues.
This commit is contained in:
@@ -19,6 +19,11 @@ linters:
|
||||
- unconvert
|
||||
# Configure checks. Mostly using defaults but with some commented exceptions.
|
||||
settings:
|
||||
govet:
|
||||
enable-all: true
|
||||
disable:
|
||||
- fieldalignment
|
||||
- shadow
|
||||
staticcheck:
|
||||
# With staticcheck there is only one setting, so to extend the implicit
|
||||
# default value it must be explicitly included.
|
||||
|
||||
@@ -497,9 +497,6 @@ func (f *Fs) purgeCheck(ctx context.Context, dir string, check bool) error {
|
||||
}
|
||||
|
||||
f.dirCache.FlushDir(dir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -44,11 +44,6 @@ func NewDriver(ctx context.Context, root string, mntOpt *mountlib.Options, vfsOp
|
||||
return nil, fmt.Errorf("failed to create cache directory: %s: %w", cacheDir, err)
|
||||
}
|
||||
|
||||
//err = file.MkdirAll(root, 0755)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create mount root: %s: %w", root, err)
|
||||
}
|
||||
|
||||
// setup driver state
|
||||
if mntOpt == nil {
|
||||
mntOpt = &mountlib.Opt
|
||||
|
||||
@@ -233,7 +233,6 @@ func (r *results) checkStringPositions(k, s string) {
|
||||
fs.Infof(r.f, "Writing position file 0x%0X", s)
|
||||
positionError := internal.PositionNone
|
||||
res := internal.ControlResult{
|
||||
Text: s,
|
||||
WriteError: make(map[internal.Position]string, 3),
|
||||
GetError: make(map[internal.Position]string, 3),
|
||||
InList: make(map[internal.Position]internal.Presence, 3),
|
||||
|
||||
@@ -46,8 +46,7 @@ func main() {
|
||||
var remoteNames []string
|
||||
for _, r := range remotes {
|
||||
remoteNames = append(remoteNames, r.Remote)
|
||||
for k, v := range *r.ControlCharacters {
|
||||
v.Text = k
|
||||
for k := range *r.ControlCharacters {
|
||||
quoted := strconv.Quote(k)
|
||||
charsMap[k] = quoted[1 : len(quoted)-1]
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ var PositionList = []Position{PositionMiddle, PositionLeft, PositionRight}
|
||||
|
||||
// ControlResult contains the result of a single character test
|
||||
type ControlResult struct {
|
||||
Text string `json:"-"`
|
||||
WriteError map[Position]string
|
||||
GetError map[Position]string
|
||||
InList map[Position]Presence
|
||||
|
||||
@@ -105,9 +105,7 @@ func TestMultithreadCalculateNumChunks(t *testing.T) {
|
||||
{size: (1 << 20) - 1, chunkSize: 2, wantNumChunks: 1 << 19},
|
||||
} {
|
||||
t.Run(fmt.Sprintf("%+v", test), func(t *testing.T) {
|
||||
mc := &multiThreadCopyState{
|
||||
size: test.size,
|
||||
}
|
||||
mc := &multiThreadCopyState{}
|
||||
mc.numChunks = calculateNumChunks(test.size, test.chunkSize)
|
||||
assert.Equal(t, test.wantNumChunks, mc.numChunks)
|
||||
})
|
||||
|
||||
@@ -57,7 +57,7 @@ func Walk(err error, f WalkFunc) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if reflect.DeepEqual(err, prev) {
|
||||
if reflect.DeepEqual(err, prev) { //nolint:govet // deepequalerrors
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user