Skip to content

Commit bbc8ac5

Browse files
committed
fix(cmd): suppress gosec G115 for terminal dimension conversions
1 parent 9425bd0 commit bbc8ac5

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

internal/cmd/attach.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ func attachExec(ctx context.Context, client *docker.Client, dir string, session
324324
defer close(resizeCh)
325325

326326
if w, h, sizeErr := term.GetSize(fd); sizeErr == nil {
327-
resizeCh <- docker.TerminalSize{Width: uint(w), Height: uint(h)}
327+
resizeCh <- docker.TerminalSize{Width: uint(w), Height: uint(h)} //nolint:gosec // terminal dimensions are always positive
328328
}
329329

330330
done := make(chan struct{})
@@ -336,9 +336,9 @@ func attachExec(ctx context.Context, client *docker.Client, dir string, session
336336
defer close(sigDone)
337337
for {
338338
select {
339-
case <-sigCh:
340-
if w, h, err := term.GetSize(fd); err == nil {
341-
resizeCh <- docker.TerminalSize{Width: uint(w), Height: uint(h)}
339+
case <-sigCh:
340+
if w, h, err := term.GetSize(fd); err == nil {
341+
resizeCh <- docker.TerminalSize{Width: uint(w), Height: uint(h)} //nolint:gosec // terminal dimensions are always positive
342342
}
343343
case <-ctx.Done():
344344
return
@@ -361,9 +361,9 @@ func attachExec(ctx context.Context, client *docker.Client, dir string, session
361361
defer ticker.Stop()
362362
for {
363363
select {
364-
case <-ticker.C:
365-
if w, h, err := term.GetSize(fd); err == nil && (w != lastW || h != lastH) {
366-
resizeCh <- docker.TerminalSize{Width: uint(w), Height: uint(h)}
364+
case <-ticker.C:
365+
if w, h, err := term.GetSize(fd); err == nil && (w != lastW || h != lastH) {
366+
resizeCh <- docker.TerminalSize{Width: uint(w), Height: uint(h)} //nolint:gosec // terminal dimensions are always positive
367367
lastW, lastH = w, h
368368
}
369369
case <-ctx.Done():

0 commit comments

Comments
 (0)