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
|
- unconvert
|
||||||
# Configure checks. Mostly using defaults but with some commented exceptions.
|
# Configure checks. Mostly using defaults but with some commented exceptions.
|
||||||
settings:
|
settings:
|
||||||
|
govet:
|
||||||
|
enable-all: true
|
||||||
|
disable:
|
||||||
|
- fieldalignment
|
||||||
|
- shadow
|
||||||
staticcheck:
|
staticcheck:
|
||||||
# With staticcheck there is only one setting, so to extend the implicit
|
# With staticcheck there is only one setting, so to extend the implicit
|
||||||
# default value it must be explicitly included.
|
# 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)
|
f.dirCache.FlushDir(dir)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
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)
|
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
|
// setup driver state
|
||||||
if mntOpt == nil {
|
if mntOpt == nil {
|
||||||
mntOpt = &mountlib.Opt
|
mntOpt = &mountlib.Opt
|
||||||
|
|||||||
@@ -233,7 +233,6 @@ func (r *results) checkStringPositions(k, s string) {
|
|||||||
fs.Infof(r.f, "Writing position file 0x%0X", s)
|
fs.Infof(r.f, "Writing position file 0x%0X", s)
|
||||||
positionError := internal.PositionNone
|
positionError := internal.PositionNone
|
||||||
res := internal.ControlResult{
|
res := internal.ControlResult{
|
||||||
Text: s,
|
|
||||||
WriteError: make(map[internal.Position]string, 3),
|
WriteError: make(map[internal.Position]string, 3),
|
||||||
GetError: make(map[internal.Position]string, 3),
|
GetError: make(map[internal.Position]string, 3),
|
||||||
InList: make(map[internal.Position]internal.Presence, 3),
|
InList: make(map[internal.Position]internal.Presence, 3),
|
||||||
|
|||||||
@@ -46,8 +46,7 @@ func main() {
|
|||||||
var remoteNames []string
|
var remoteNames []string
|
||||||
for _, r := range remotes {
|
for _, r := range remotes {
|
||||||
remoteNames = append(remoteNames, r.Remote)
|
remoteNames = append(remoteNames, r.Remote)
|
||||||
for k, v := range *r.ControlCharacters {
|
for k := range *r.ControlCharacters {
|
||||||
v.Text = k
|
|
||||||
quoted := strconv.Quote(k)
|
quoted := strconv.Quote(k)
|
||||||
charsMap[k] = quoted[1 : len(quoted)-1]
|
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
|
// ControlResult contains the result of a single character test
|
||||||
type ControlResult struct {
|
type ControlResult struct {
|
||||||
Text string `json:"-"`
|
|
||||||
WriteError map[Position]string
|
WriteError map[Position]string
|
||||||
GetError map[Position]string
|
GetError map[Position]string
|
||||||
InList map[Position]Presence
|
InList map[Position]Presence
|
||||||
|
|||||||
@@ -105,9 +105,7 @@ func TestMultithreadCalculateNumChunks(t *testing.T) {
|
|||||||
{size: (1 << 20) - 1, chunkSize: 2, wantNumChunks: 1 << 19},
|
{size: (1 << 20) - 1, chunkSize: 2, wantNumChunks: 1 << 19},
|
||||||
} {
|
} {
|
||||||
t.Run(fmt.Sprintf("%+v", test), func(t *testing.T) {
|
t.Run(fmt.Sprintf("%+v", test), func(t *testing.T) {
|
||||||
mc := &multiThreadCopyState{
|
mc := &multiThreadCopyState{}
|
||||||
size: test.size,
|
|
||||||
}
|
|
||||||
mc.numChunks = calculateNumChunks(test.size, test.chunkSize)
|
mc.numChunks = calculateNumChunks(test.size, test.chunkSize)
|
||||||
assert.Equal(t, test.wantNumChunks, mc.numChunks)
|
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
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user