Skip to content

Commit 8039c85

Browse files
Fix linter issues
Signed-off-by: Juan-Luis de Sousa-Valadas Castaño <[email protected]>
1 parent f9d90e0 commit 8039c85

File tree

5 files changed

+25
-16
lines changed

5 files changed

+25
-16
lines changed

protocol/ssh/signals.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ func termSizeWNCH() []byte {
5757
binary.BigEndian.PutUint32(size, 40)
5858
binary.BigEndian.PutUint32(size[4:], 80)
5959
} else {
60-
binary.BigEndian.PutUint32(size, uint32(cols))
61-
binary.BigEndian.PutUint32(size[4:], uint32(rows))
60+
binary.BigEndian.PutUint32(size, uint32(cols)) // #nosec G115 -- ignore "integer overflow conversion int -> uint32"
61+
binary.BigEndian.PutUint32(size[4:], uint32(rows)) // #nosec G115 -- ignore "integer overflow conversion int -> uint32"
6262
}
6363

6464
return size

remotefs/posixfs.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ func posixBitsToFileMode(bits int64) fs.FileMode {
154154
}
155155

156156
// Mapping permission bits
157-
mode |= fs.FileMode(bits & 0o777) // Owner, group, and other permissions
157+
// Owner, group, and other permissions
158+
mode |= fs.FileMode(bits & 0o777) // #nosec G115 -- ignore "integer overflow conversion int64 -> uint64"
158159

159160
// Mapping special permission bits
160161
if bits&0o4000 != 0 { // Set-user-ID

remotefs/withname.go

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,22 @@ package remotefs
33
import "io/fs"
44

55
const (
6-
OpClose = "close" // OpClose Close operation
7-
OpOpen = "open" // OpOpen Open operation
8-
OpRead = "read" // OpRead Read operation
9-
OpSeek = "seek" // OpSeek Seek operation
10-
OpStat = "stat" // OpStat Stat operation
11-
OpWrite = "write" // OpWrite Write operation
12-
OpCopyTo = "copy-to" // OpCopyTo CopyTo operation
13-
OpCopyFrom = "copy-from" // OpCopyFrom CopyFrom operation
6+
// OpClose Close operation.
7+
OpClose = "close"
8+
// OpOpen Open operation.
9+
OpOpen = "open"
10+
// OpRead Read operation.
11+
OpRead = "read"
12+
// OpSeek Seek operation.
13+
OpSeek = "seek"
14+
// OpStat Stat operation.
15+
OpStat = "stat"
16+
// OpWrite Write operation.
17+
OpWrite = "write"
18+
// OpCopyTo CopyTo operation.
19+
OpCopyTo = "copy-to"
20+
// OpCopyFrom CopyFrom operation.
21+
OpCopyFrom = "copy-from"
1422
)
1523

1624
type withPath struct {

sshconfig/printer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ func (p *printer) number(key string) (string, bool) {
128128
}
129129
if field, err := p.get(key, reflect.Uint); err == nil {
130130
if key == "StreamLocalBindMask" {
131-
return "0" + strconv.FormatInt(int64(field.Uint()), 8), true
131+
return "0" + strconv.FormatInt(int64(field.Uint()), 8), true // #nosec G115 -- ignore "integer overflow conversion int64 -> uint64"
132132
}
133-
return strconv.FormatInt(int64(field.Uint()), 10), true
133+
return strconv.FormatInt(int64(field.Uint()), 10), true // #nosec G115 -- ignore "integer overflow conversion int64 -> uint64"
134134
}
135135
return "", false
136136
}

sshconfig/set.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,7 @@ func (s *Setter) expandToken(token string) (string, error) { //nolint:cyclop
11251125

11261126
if f, err := s.get("Port", reflect.Uint); err == nil {
11271127
if f.Uint() > 0 {
1128-
return strconv.Itoa(int(f.Uint())), nil
1128+
return strconv.Itoa(int(f.Uint())), nil // #nosec G115 -- ignore "integer overflow conversion uint64 -> int"
11291129
}
11301130
}
11311131
if f, err := s.get("Port", reflect.String); err == nil {
@@ -1349,7 +1349,7 @@ func (s *Setter) matchesHost(conditions ...string) (bool, error) {
13491349
// matchesMatch checks if the Match directive conditions are met.
13501350
func (s *Setter) matchesMatch(conditions ...string) (bool, error) { //nolint:funlen,cyclop // TODO extract functions
13511351
log.Trace(context.Background(), "matching Match directive", "conditions", conditions)
1352-
for i := range len(conditions) {
1352+
for i := range conditions {
13531353
condition := conditions[i]
13541354
log.Trace(context.Background(), "matching Match directive", "condition", condition)
13551355
var negate bool
@@ -1607,7 +1607,7 @@ func (s *Setter) canonicalizeMaxDots() int {
16071607
if md, err := s.get("CanonicalizeMaxDots", reflect.Int); err == nil {
16081608
return int(md.Int())
16091609
} else if md, err := s.get("CanonicalizeMaxDots", reflect.Uint); err == nil {
1610-
return int(md.Uint())
1610+
return int(md.Uint()) // #nosec G115 -- ignore "integer overflow conversion int64 -> uint64"
16111611
}
16121612
return 1
16131613
}

0 commit comments

Comments
 (0)