diff --git a/tests/bcr/MODULE.bazel b/tests/bcr/MODULE.bazel index 6c548ced4..a6ba6cbfe 100644 --- a/tests/bcr/MODULE.bazel +++ b/tests/bcr/MODULE.bazel @@ -10,6 +10,10 @@ local_path_override( bazel_dep(name = "rules_go", version = "0.39.1", repo_name = "my_rules_go") +# This bazel_dep provides the Go dependency github.com/cloudflare/circl, which requires custom +# patches beyond what Gazelle can generate. +bazel_dep(name = "circl", version = "1.3.3") + go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps") # Validate a go.mod replace directive works. diff --git a/tests/bcr/go.mod b/tests/bcr/go.mod index e91a5e16d..aa9a3b8dd 100644 --- a/tests/bcr/go.mod +++ b/tests/bcr/go.mod @@ -10,6 +10,7 @@ require ( github.com/DataDog/sketches-go v1.4.1 github.com/bazelbuild/rules_go v0.39.1 github.com/bmatcuk/doublestar/v4 v4.0.0 + github.com/cloudflare/circl v1.3.3 github.com/envoyproxy/protoc-gen-validate v1.0.1 github.com/fmeum/dep_on_gazelle v1.0.0 github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2 @@ -19,5 +20,6 @@ require ( github.com/bazelbuild/bazel-gazelle v0.30.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + golang.org/x/sys v0.7.0 // indirect google.golang.org/protobuf v1.28.0 // indirect ) diff --git a/tests/bcr/go.sum b/tests/bcr/go.sum index c153f0d34..6ced31513 100644 --- a/tests/bcr/go.sum +++ b/tests/bcr/go.sum @@ -6,6 +6,8 @@ github.com/bazelbuild/rules_go v0.39.1 h1:wkJLUDx59dntWMghuL8++GteoU1To6sRoKJXuy github.com/bazelbuild/rules_go v0.39.1/go.mod h1:TMHmtfpvyfsxaqfL9WnahCsXMWDMICTw7XeK9yVb+YU= github.com/bmatcuk/doublestar v1.3.4 h1:gPypJ5xD31uhX6Tf54sDPUOBXTqKH4c9aPY66CyQrS0= github.com/bmatcuk/doublestar v1.3.4/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE= +github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= +github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -32,6 +34,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/tests/bcr/pkg/BUILD.bazel b/tests/bcr/pkg/BUILD.bazel index 1f17fc3c5..655018968 100644 --- a/tests/bcr/pkg/BUILD.bazel +++ b/tests/bcr/pkg/BUILD.bazel @@ -5,6 +5,7 @@ go_test( srcs = ["pkg_test.go"], deps = [ "//pkg/data", + "@circl//dh/x25519", "@com_github_bmatcuk_doublestar_v4//:doublestar", "@com_github_datadog_sketches_go//ddsketch", "@com_github_envoyproxy_protoc_gen_validate//validate", diff --git a/tests/bcr/pkg/pkg_test.go b/tests/bcr/pkg/pkg_test.go index e2b62b6c5..4a33e8c56 100644 --- a/tests/bcr/pkg/pkg_test.go +++ b/tests/bcr/pkg/pkg_test.go @@ -1,13 +1,15 @@ package pkg import ( + "crypto/rand" "os" "testing" + "github.com/DataDog/sketches-go/ddsketch" "github.com/bazelbuild/bazel-gazelle/tests/bcr/pkg/data" "github.com/bazelbuild/rules_go/go/runfiles" "github.com/bmatcuk/doublestar/v4" - "github.com/DataDog/sketches-go/ddsketch" + "github.com/cloudflare/circl/dh/x25519" "github.com/fmeum/dep_on_gazelle" "github.com/google/safetext/yamltemplate" "github.com/stretchr/testify/require" @@ -54,3 +56,10 @@ func TestNoGoRepositoryForRulesGoAndGazelle(t *testing.T) { func TestIndirectlyUseGazelle(t *testing.T) { dep_on_gazelle.MakeLabel("foo", "bar", "baz") } + +func TestBazelDepUsedAsGoDep(t *testing.T) { + var public, secret x25519.Key + _, err := rand.Read(secret[:]) + require.NoError(t, err) + x25519.KeyGen(&public, &secret) +}