From 2bb2aa3d8e16659a592c77ec8828dc637139270f Mon Sep 17 00:00:00 2001 From: Laurent Demailly Date: Tue, 17 Sep 2024 15:06:48 -0700 Subject: [PATCH] Updates for golangci-lint v1.61.0 (some gosec improvements) (#239) * Updates for golangci-lint v1.61.0 (some gosec improvements) * forgot this didn't use the shared workflow setup --- .github/workflows/gochecks.yml | 2 +- extensions/images.go | 4 ++-- extensions/shell.go | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gochecks.yml b/.github/workflows/gochecks.yml index f79585ed..5f5520c7 100644 --- a/.github/workflows/gochecks.yml +++ b/.github/workflows/gochecks.yml @@ -34,7 +34,7 @@ jobs: if: matrix.os == 'ubuntu-latest' uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # pin@v6 with: - version: v1.60.3 + version: v1.61.0 - name: Install Git Bash run: | choco install git diff --git a/extensions/images.go b/extensions/images.go index 6f0c8aca..94408eec 100644 --- a/extensions/images.go +++ b/extensions/images.go @@ -107,7 +107,7 @@ func elem2ColorComponent(o object.Object) (uint8, *object.Error) { if i < 0 || i > 255 { return 0, object.Errorfp("color component out of range (should be 0-255): %s", o.Inspect()) } - return uint8(i), nil //nolint:gosec // gosec not smart enough to see the range check just above this. + return uint8(i), nil } func rgbArrayToRBGAColor(arr []object.Object) (color.NRGBA, *object.Error) { @@ -425,7 +425,7 @@ func createVectorImageFunctions(cdata ImageMap) { //nolint:funlen // this is a g } func mergeAdd(img1, img2 *image.NRGBA) { - //nolint:gosec // gosec not smart enough to see the range checks. + //nolint:gosec // gosec not smart enough to see the range checks with min - https://github.com/securego/gosec/issues/1212 for y := range img1.Bounds().Dy() { for x := range img1.Bounds().Dx() { p1 := img1.NRGBAAt(x, y) diff --git a/extensions/shell.go b/extensions/shell.go index cca9720b..80f23ff2 100644 --- a/extensions/shell.go +++ b/extensions/shell.go @@ -68,6 +68,7 @@ func createShellFunctions() { if s.Term != nil { s.Term.Suspend() } + //nolint:fatcontext // we do need to update/reset the context and its cancel function. s.Context, s.Cancel = context.WithCancel(context.Background()) // no timeout. cmd, oerr := createCmd(*s, args) if oerr != nil {