Skip to content

Commit

Permalink
chore: replace slices.Contains with utils.Contains
Browse files Browse the repository at this point in the history
We were getting the following gosec error when using `slices.Contains`:

```
could not import slices (invalid package name: "")
```

This is because:

- `slices` was added in Go 1.21
- Support for Go 1.21 was added in gosec 2.17
- We are currently using gosec 2.15.0 and via salus 3.2.5 via federacy/scan-action which pulls `coinbase/salus:latest`

Salus 3.2.6 has been released with the gosec version bump but it isn't tagged `latest`. I've filed coinbase/salus#880 to address.

For now, the easiest thing to do was just to not use the `slices` module, which was easy because we already have a util which does the same thing.
  • Loading branch information
nmanoogian committed Feb 15, 2024
1 parent 2ae9ab9 commit dde6f0e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/configuration/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ limitations under the License.
package configuration

import (
"slices"

"github.com/DopplerHQ/cli/pkg/models"
"github.com/DopplerHQ/cli/pkg/utils"
)

func GetFlag(flag string) bool {
Expand Down Expand Up @@ -71,7 +70,7 @@ func GetFlagDefault(flag string) bool {

func IsValidFlag(flag string) bool {
flags := models.GetFlags()
return slices.Contains(flags, flag)
return utils.Contains(flags, flag)
}

func IsAnalyticsEnabled() bool {
Expand Down

0 comments on commit dde6f0e

Please sign in to comment.