mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 17:31:43 +00:00
chore(deps): replace internal/slices (#63386)
With an open-source package with more features. Ran: ``` sg bazel configure bazel run //:gazelle-update-repos ``` Between writing that little slices package, and wanting more from it in an upcoming PR, I found out this 3rd party library existed. It seems very good.
This commit is contained in:
parent
4641bc5023
commit
c1417b3eaa
11
deps.bzl
11
deps.bzl
@ -4063,6 +4063,13 @@ def go_dependencies():
|
||||
sum = "h1:JLvn7D+wXjH9g4Jsjo+VqmzTUpl/LX7vfr6VOfSWTdM=",
|
||||
version = "v0.0.0-20240327125255-dbf53b6cbf06",
|
||||
)
|
||||
go_repository(
|
||||
name = "com_github_life4_genesis",
|
||||
build_file_proto_mode = "disable_global",
|
||||
importpath = "github.com/life4/genesis",
|
||||
sum = "h1:Ww36apMVRnC7gdB7RDI5B66Q1tjmO8g1QEW5nq2c/SU=",
|
||||
version = "v1.10.3",
|
||||
)
|
||||
go_repository(
|
||||
name = "com_github_linode_linodego",
|
||||
build_file_proto_mode = "disable_global",
|
||||
@ -4179,8 +4186,8 @@ def go_dependencies():
|
||||
name = "com_github_matryer_is",
|
||||
build_file_proto_mode = "disable_global",
|
||||
importpath = "github.com/matryer/is",
|
||||
sum = "h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A=",
|
||||
version = "v1.2.0",
|
||||
sum = "h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE=",
|
||||
version = "v1.4.0",
|
||||
)
|
||||
go_repository(
|
||||
name = "com_github_matryer_moq",
|
||||
|
||||
2
go.mod
2
go.mod
@ -282,6 +282,7 @@ require (
|
||||
github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa
|
||||
github.com/jackc/pgx/v5 v5.5.5
|
||||
github.com/jomei/notionapi v1.13.0
|
||||
github.com/life4/genesis v1.10.3
|
||||
github.com/maxbrunsfeld/counterfeiter/v6 v6.8.1
|
||||
github.com/mitchellh/hashstructure/v2 v2.0.2
|
||||
github.com/mroth/weightedrand/v2 v2.0.1
|
||||
@ -409,7 +410,6 @@ require (
|
||||
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
|
||||
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/matryer/is v1.2.0 // indirect
|
||||
github.com/mazznoer/csscolorparser v0.1.3 // indirect
|
||||
github.com/mfridman/interpolate v0.0.2 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
|
||||
6
go.sum
6
go.sum
@ -1202,6 +1202,8 @@ github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||
github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw=
|
||||
github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||
github.com/life4/genesis v1.10.3 h1:Ww36apMVRnC7gdB7RDI5B66Q1tjmO8g1QEW5nq2c/SU=
|
||||
github.com/life4/genesis v1.10.3/go.mod h1:jhY+sEN403+0uE54fjVAdVCYY8SCIrKioAatOlVJoGo=
|
||||
github.com/logrusorgru/aurora/v3 v3.0.0/go.mod h1:vsR12bk5grlLvLXAYrBsb5Oc/N+LxAlxggSjiwMnCUc=
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||
@ -1219,8 +1221,8 @@ github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN
|
||||
github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs=
|
||||
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
|
||||
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
||||
github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A=
|
||||
github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
|
||||
github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE=
|
||||
github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
|
||||
github.com/matryer/moq v0.2.3/go.mod h1:9RtPYjTnH1bSBIkpvtHkFN7nbWAnO7oRpdJkEIn6UtE=
|
||||
github.com/mattermost/xml-roundtrip-validator v0.1.0 h1:RXbVD2UAl7A7nOTR4u7E3ILa4IbtvKBHw64LDsmu9hU=
|
||||
github.com/mattermost/xml-roundtrip-validator v0.1.0/go.mod h1:qccnGMcpgwcNaBnxqpJpWWUiPNr5H3O8eDgGV9gT5To=
|
||||
|
||||
@ -102,8 +102,8 @@ go_test(
|
||||
deps = [
|
||||
"//internal/appliance/config",
|
||||
"//internal/appliance/yaml",
|
||||
"//internal/slices",
|
||||
"@com_github_go_logr_stdr//:stdr",
|
||||
"@com_github_life4_genesis//slices",
|
||||
"@com_github_stretchr_testify//require",
|
||||
"@com_github_stretchr_testify//suite",
|
||||
"@io_bazel_rules_go//go/runfiles:go_default_library",
|
||||
|
||||
@ -6,6 +6,7 @@ import (
|
||||
"regexp"
|
||||
"time"
|
||||
|
||||
"github.com/life4/genesis/slices"
|
||||
rbacv1 "k8s.io/api/rbac/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
@ -13,7 +14,6 @@ import (
|
||||
k8syaml "sigs.k8s.io/yaml"
|
||||
|
||||
applianceyaml "github.com/sourcegraph/sourcegraph/internal/appliance/yaml"
|
||||
"github.com/sourcegraph/sourcegraph/internal/slices"
|
||||
)
|
||||
|
||||
// Test helpers
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
load("//dev:go_defs.bzl", "go_test")
|
||||
|
||||
go_library(
|
||||
name = "slices",
|
||||
srcs = ["sliceutils.go"],
|
||||
importpath = "github.com/sourcegraph/sourcegraph/internal/slices",
|
||||
visibility = ["//:__subpackages__"],
|
||||
)
|
||||
|
||||
go_test(
|
||||
name = "slices_test",
|
||||
srcs = ["sliceutils_test.go"],
|
||||
deps = [
|
||||
":slices",
|
||||
"@com_github_stretchr_testify//assert",
|
||||
],
|
||||
)
|
||||
@ -1,9 +0,0 @@
|
||||
package slices
|
||||
|
||||
func Map[S, T any](list []S, f func(S) T) []T {
|
||||
ret := make([]T, len(list))
|
||||
for i, e := range list {
|
||||
ret[i] = f(e)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
package slices_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/slices"
|
||||
)
|
||||
|
||||
func TestMap(t *testing.T) {
|
||||
input := []int{1, 2, 3}
|
||||
|
||||
res := slices.Map(input, func(i int) int { return i + 1 })
|
||||
expected := []int{2, 3, 4}
|
||||
assert.Equal(t, expected, res)
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user