Skip to content

Commit

Permalink
Add a dep on circl
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Jun 2, 2023
1 parent 5eb59ef commit 060f8c0
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tests/bcr/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions tests/bcr/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
)
4 changes: 4 additions & 0 deletions tests/bcr/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand All @@ -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=
Expand Down
1 change: 1 addition & 0 deletions tests/bcr/pkg/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 10 additions & 1 deletion tests/bcr/pkg/pkg_test.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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)
}

0 comments on commit 060f8c0

Please sign in to comment.