1
0
mirror of https://github.com/rclone/rclone.git synced 2025-10-30 23:17:59 +02:00

build: enable all govet checks (except fieldalignment and shadow) and fix issues.

This commit is contained in:
Oleksandr Redko
2025-10-22 20:37:58 +03:00
committed by GitHub
parent b272c50c4c
commit c8a834f0e8
8 changed files with 8 additions and 16 deletions

View File

@@ -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.

View File

@@ -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
}

View File

@@ -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

View File

@@ -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),

View File

@@ -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]
}

View File

@@ -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

View File

@@ -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)
})

View File

@@ -57,7 +57,7 @@ func Walk(err error, f WalkFunc) {
}
}
}
if reflect.DeepEqual(err, prev) {
if reflect.DeepEqual(err, prev) { //nolint:govet // deepequalerrors
break
}
}