Skip to content

Commit 55f5848

Browse files
committed
Fix static check lint problems
1 parent db8773b commit 55f5848

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

mega.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ func (fs *MegaFS) PathLookup(root *Node, ns []string) ([]*Node, error) {
301301
}
302302

303303
var err error
304-
var found bool = true
304+
var found = true
305305

306306
nodepath := []*Node{}
307307

@@ -317,12 +317,12 @@ func (fs *MegaFS) PathLookup(root *Node, ns []string) ([]*Node, error) {
317317
}
318318
}
319319

320-
if found == false {
320+
if !found {
321321
break
322322
}
323323
}
324324

325-
if found == false {
325+
if !found {
326326
err = ENOENT
327327
}
328328

@@ -508,7 +508,7 @@ func (m *Mega) api_request(r []byte) (buf []byte, err error) {
508508

509509
// at this point the body is read and closed
510510

511-
if bytes.HasPrefix(buf, []byte("[")) == false && bytes.HasPrefix(buf, []byte("-")) == false {
511+
if !bytes.HasPrefix(buf, []byte("[")) && !bytes.HasPrefix(buf, []byte("-")) {
512512
return nil, EBADRESP
513513
}
514514

@@ -1246,7 +1246,7 @@ func (d *Download) Finish() (err error) {
12461246
if err != nil {
12471247
return err
12481248
}
1249-
if bytes.Equal(btmac, d.src.meta.mac) == false {
1249+
if !bytes.Equal(btmac, d.src.meta.mac) {
12501250
return EMACMISMATCH
12511251
}
12521252

@@ -1395,7 +1395,7 @@ func (m *Mega) NewUpload(parent *Node, name string, fileSize int64) (*Upload, er
13951395
}
13961396

13971397
ukey := []uint32{0, 0, 0, 0, 0, 0}
1398-
for i, _ := range ukey {
1398+
for i := range ukey {
13991399
ukey[i] = uint32(mrand.Int31())
14001400

14011401
}
@@ -1535,7 +1535,7 @@ func (u *Upload) UploadChunk(id int, chunk []byte) (err error) {
15351535
return err
15361536
}
15371537

1538-
if bytes.Equal(chunk_resp, nil) == false {
1538+
if !bytes.Equal(chunk_resp, nil) {
15391539
u.mutex.Lock()
15401540
u.completion_handle = chunk_resp
15411541
u.mutex.Unlock()
@@ -1814,7 +1814,7 @@ func (m *Mega) CreateDir(name string, parent *Node) (*Node, error) {
18141814
var res [1]UploadCompleteResp
18151815

18161816
compkey := []uint32{0, 0, 0, 0, 0, 0}
1817-
for i, _ := range compkey {
1817+
for i := range compkey {
18181818
compkey[i] = uint32(mrand.Int31())
18191819
}
18201820

@@ -1871,7 +1871,7 @@ func (m *Mega) Delete(node *Node, destroy bool) error {
18711871
if node == nil {
18721872
return EARGS
18731873
}
1874-
if destroy == false {
1874+
if !destroy {
18751875
return m.Move(node, m.FS.trash)
18761876
}
18771877

utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func bytes_to_a32(b []byte) ([]uint32, error) {
4242
length := len(b) + 3
4343
a := make([]uint32, length/4)
4444
buf := bytes.NewBuffer(b)
45-
for i, _ := range a {
45+
for i := range a {
4646
err := binary.Read(buf, binary.BigEndian, &a[i])
4747
if err != nil {
4848
return nil, err

0 commit comments

Comments
 (0)