build: fix gocritic lint issue assignop

This commit is contained in:
albertony 2024-05-31 14:37:21 +02:00 committed by Nick Craig-Wood
parent 59501fcdb6
commit c6d3714e73
10 changed files with 13 additions and 13 deletions

View file

@ -417,7 +417,7 @@ func TestInternalWrappedFsChangeNotSeen(t *testing.T) {
if runInstance.rootIsCrypt { if runInstance.rootIsCrypt {
data2, err = base64.StdEncoding.DecodeString(cryptedText3Base64) data2, err = base64.StdEncoding.DecodeString(cryptedText3Base64)
require.NoError(t, err) require.NoError(t, err)
expectedSize = expectedSize + 1 // FIXME newline gets in, likely test data issue expectedSize++ // FIXME newline gets in, likely test data issue
} else { } else {
data2 = []byte("test content") data2 = []byte("test content")
} }
@ -1192,7 +1192,7 @@ func (r *run) updateData(t *testing.T, rootFs fs.Fs, src, data, append string) e
func (r *run) cleanSize(t *testing.T, size int64) int64 { func (r *run) cleanSize(t *testing.T, size int64) int64 {
if r.rootIsCrypt { if r.rootIsCrypt {
denominator := int64(65536 + 16) denominator := int64(65536 + 16)
size = size - 32 size -= 32
quotient := size / denominator quotient := size / denominator
remainder := size % denominator remainder := size % denominator
return (quotient*65536 + remainder - 16) return (quotient*65536 + remainder - 16)

View file

@ -208,7 +208,7 @@ func (r *Handle) getChunk(chunkStart int64) ([]byte, error) {
offset := chunkStart % int64(r.cacheFs().opt.ChunkSize) offset := chunkStart % int64(r.cacheFs().opt.ChunkSize)
// we align the start offset of the first chunk to a likely chunk in the storage // we align the start offset of the first chunk to a likely chunk in the storage
chunkStart = chunkStart - offset chunkStart -= offset
r.queueOffset(chunkStart) r.queueOffset(chunkStart)
found := false found := false
@ -327,7 +327,7 @@ func (r *Handle) Seek(offset int64, whence int) (int64, error) {
chunkStart := r.offset - (r.offset % int64(r.cacheFs().opt.ChunkSize)) chunkStart := r.offset - (r.offset % int64(r.cacheFs().opt.ChunkSize))
if chunkStart >= int64(r.cacheFs().opt.ChunkSize) { if chunkStart >= int64(r.cacheFs().opt.ChunkSize) {
chunkStart = chunkStart - int64(r.cacheFs().opt.ChunkSize) chunkStart -= int64(r.cacheFs().opt.ChunkSize)
} }
r.queueOffset(chunkStart) r.queueOffset(chunkStart)

View file

@ -329,7 +329,7 @@ func (c *Cipher) obfuscateSegment(plaintext string) string {
for _, runeValue := range plaintext { for _, runeValue := range plaintext {
dir += int(runeValue) dir += int(runeValue)
} }
dir = dir % 256 dir %= 256
// We'll use this number to store in the result filename... // We'll use this number to store in the result filename...
var result bytes.Buffer var result bytes.Buffer
@ -450,7 +450,7 @@ func (c *Cipher) deobfuscateSegment(ciphertext string) (string, error) {
if pos >= 26 { if pos >= 26 {
pos -= 6 pos -= 6
} }
pos = pos - thisdir pos -= thisdir
if pos < 0 { if pos < 0 {
pos += 52 pos += 52
} }

View file

@ -56,7 +56,7 @@ func (ik *ImageKit) URL(params URLParam) (string, error) {
var expires = strconv.FormatInt(now+params.ExpireSeconds, 10) var expires = strconv.FormatInt(now+params.ExpireSeconds, 10)
var path = strings.Replace(resultURL, endpoint, "", 1) var path = strings.Replace(resultURL, endpoint, "", 1)
path = path + expires path += expires
mac := hmac.New(sha1.New, []byte(ik.PrivateKey)) mac := hmac.New(sha1.New, []byte(ik.PrivateKey))
mac.Write([]byte(path)) mac.Write([]byte(path))
signature := hex.EncodeToString(mac.Sum(nil)) signature := hex.EncodeToString(mac.Sum(nil))

View file

@ -347,7 +347,7 @@ func calcGcid(r io.Reader, size int64) (string, error) {
calcBlockSize := func(j int64) int64 { calcBlockSize := func(j int64) int64 {
var psize int64 = 0x40000 var psize int64 = 0x40000
for float64(j)/float64(psize) > 0x200 && psize < 0x200000 { for float64(j)/float64(psize) > 0x200 && psize < 0x200000 {
psize = psize << 1 psize <<= 1
} }
return psize return psize
} }

View file

@ -903,7 +903,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
// Backward compatible to old config // Backward compatible to old config
if len(opt.Upstreams) == 0 && len(opt.Remotes) > 0 { if len(opt.Upstreams) == 0 && len(opt.Remotes) > 0 {
for i := 0; i < len(opt.Remotes)-1; i++ { for i := 0; i < len(opt.Remotes)-1; i++ {
opt.Remotes[i] = opt.Remotes[i] + ":ro" opt.Remotes[i] += ":ro"
} }
opt.Upstreams = opt.Remotes opt.Upstreams = opt.Remotes
} }

View file

@ -157,7 +157,7 @@ type server struct {
} }
func (s *server) sendMsg(msg string) { func (s *server) sendMsg(msg string) {
msg = msg + "\n" msg += "\n"
if _, err := io.WriteString(s.writer, msg); err != nil { if _, err := io.WriteString(s.writer, msg); err != nil {
panic(err) panic(err)
} }

View file

@ -527,7 +527,7 @@ func (acc *Account) String() string {
} }
if acc.ci.DataRateUnit == "bits" { if acc.ci.DataRateUnit == "bits" {
cur = cur * 8 cur *= 8
} }
percentageDone := 0 percentageDone := 0

View file

@ -88,7 +88,7 @@ func testConfigFile(t *testing.T, options []fs.Option, configFileName string) fu
func makeReadLine(answers []string) func() string { func makeReadLine(answers []string) func() string {
i := 0 i := 0
return func() string { return func() string {
i = i + 1 i++
return answers[i-1] return answers[i-1]
} }
} }

View file

@ -42,7 +42,7 @@ func MkdirAll(path string, perm os.FileMode) error {
// In extended-length form without trailing slash ("\\?\C:"), os.Stat // In extended-length form without trailing slash ("\\?\C:"), os.Stat
// and os.Mkdir both fails. With trailing slash ("\\?\C:\") works, // and os.Mkdir both fails. With trailing slash ("\\?\C:\") works,
// and regular paths with or without it ("C:" and "C:\") both works. // and regular paths with or without it ("C:" and "C:\") both works.
path = path + string(os.PathSeparator) path += string(os.PathSeparator)
} else { } else {
// See if there is a parent to be created first. // See if there is a parent to be created first.
// Not when path refer to a drive's root directory, because we don't // Not when path refer to a drive's root directory, because we don't