Skip to content
This repository was archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
refactor: rm golang.org/x/exp dependency (#1202)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgacsal authored Feb 9, 2024
1 parent f268ae0 commit 245d12b
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 10 deletions.
5 changes: 2 additions & 3 deletions cli/families/exploits/family.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import (
"strings"
"time"

"golang.org/x/exp/maps"

"github.com/openclarity/vmclarity/cli/families/exploits/common"
"github.com/openclarity/vmclarity/cli/families/exploits/job"
"github.com/openclarity/vmclarity/cli/families/interfaces"
Expand All @@ -33,6 +31,7 @@ import (
"github.com/openclarity/vmclarity/cli/job_manager"
"github.com/openclarity/vmclarity/cli/utils"
"github.com/openclarity/vmclarity/core/log"
"github.com/openclarity/vmclarity/core/to"
)

type Exploits struct {
Expand Down Expand Up @@ -102,7 +101,7 @@ func getCVEIDsFromVulnerabilitiesResults(vulnResults *vulnerabilities.Results) s
}
}

cves := strings.Join(maps.Keys(cvesMap), ",")
cves := strings.Join(to.Keys(cvesMap), ",")

return cves
}
Expand Down
2 changes: 1 addition & 1 deletion cli/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ require (
github.com/vulsio/go-exploitdb v0.4.6
github.com/yudai/gojsondiff v1.0.0
go.uber.org/zap v1.26.0
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a
golang.org/x/sync v0.6.0
gotest.tools v2.2.0+incompatible
gotest.tools/v3 v3.5.1
Expand Down Expand Up @@ -398,6 +397,7 @@ require (
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions cli/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1519,8 +1519,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a h1:Q8/wZp0KX97QFTc2ywcOE0YRjZPVIx+MXInMzdvQqcA=
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08=
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ=
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
Expand Down
10 changes: 10 additions & 0 deletions core/to/to.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ func ValueOrZero[T any](ptr *T) T {
return t
}

// Keys returns a slice of keys from m map.
func Keys[K comparable, V any](m map[K]V) []K {
s := make([]K, 0, len(m))
for k := range m {
s = append(s, k)
}

return s
}

func ValuesSlice[K comparable, V any](m map[K]V) []V {
s := make([]V, 0, len(m))
for _, v := range m {
Expand Down
2 changes: 1 addition & 1 deletion testenv/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ require (
github.com/opencontainers/go-digest v1.0.0
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a
helm.sh/helm/v3 v3.14.0
k8s.io/api v0.29.1
k8s.io/apimachinery v0.29.1
Expand Down Expand Up @@ -209,6 +208,7 @@ require (
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
go.uber.org/mock v0.4.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions testenv/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -703,8 +703,8 @@ golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a h1:Q8/wZp0KX97QFTc2ywcOE0YRjZPVIx+MXInMzdvQqcA=
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08=
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 h1:hNQpMuAJe5CtcUqCXaWga3FHu+kQvCqcsoVaQgSV60o=
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
Expand Down
2 changes: 1 addition & 1 deletion testenv/utils/fanout/fanout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ package fanout
import (
"bytes"
"context"
"crypto/rand"
_ "embed"
"fmt"
"io"
"testing"
"time"

. "github.com/onsi/gomega"
"golang.org/x/exp/rand"
)

func TestFanOut(t *testing.T) {
Expand Down

0 comments on commit 245d12b

Please sign in to comment.