Skip to content

Commit 8018747

Browse files
authored
Merge pull request #406 from jaypipes/use-slices-contais
deps: accelerator: remove deps
2 parents 8f0a31c + bba8dfb commit 8018747

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ require (
1616
github.com/inconshreveable/mousetrap v1.1.0 // indirect
1717
github.com/kr/pretty v0.1.0 // indirect
1818
github.com/mitchellh/go-homedir v1.1.0 // indirect
19-
github.com/samber/lo v1.47.0 // indirect
2019
github.com/spf13/pflag v1.0.5 // indirect
2120
golang.org/x/sys v0.1.0 // indirect
22-
golang.org/x/text v0.16.0 // indirect
2321
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
2422
)

go.sum

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,13 @@ github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrk
1919
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
2020
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
2121
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
22-
github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc=
23-
github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU=
2422
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
2523
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
2624
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
2725
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
2826
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
2927
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
3028
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
31-
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
32-
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
3329
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
3430
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
3531
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

pkg/accelerator/accelerator_linux.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
package accelerator
77

88
import (
9-
"github.com/samber/lo"
10-
119
"github.com/jaypipes/ghw/pkg/context"
1210
"github.com/jaypipes/ghw/pkg/pci"
1311
)
@@ -48,7 +46,7 @@ func (i *Info) load() error {
4846
class := dev.Class.ID
4947
subclass := dev.Subclass.ID
5048
if subclasses, ok := acceleratorPCIClasses[class]; ok {
51-
if lo.Contains(subclasses, subclass) {
49+
if slicesContains(subclasses, subclass) {
5250
return true
5351
}
5452
}
@@ -70,3 +68,13 @@ func (i *Info) load() error {
7068
i.Devices = accelDevices
7169
return nil
7270
}
71+
72+
// TODO: delete and just use slices.Contains when the minimal golang version we support is 1.21
73+
func slicesContains(s []string, v string) bool {
74+
for i := range s {
75+
if v == s[i] {
76+
return true
77+
}
78+
}
79+
return false
80+
}

0 commit comments

Comments
 (0)