Skip to content

Commit

Permalink
Stop resolving to @io_bazel_rules_go//proto/wkt
Browse files Browse the repository at this point in the history
fixing test
  • Loading branch information
linzhp committed Jul 2, 2023
1 parent 9fe0a3f commit dcc25e8
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 37 deletions.
24 changes: 12 additions & 12 deletions language/proto/known_go_imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import "github.com/bazelbuild/bazel-gazelle/label"

var knownGoProtoImports = map[string]label.Label{

"github.com/golang/protobuf/ptypes/any": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "any_go_proto"},
"google.golang.org/genproto/protobuf/api": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "api_go_proto"},
"github.com/golang/protobuf/protoc-gen-go/plugin": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "compiler_plugin_go_proto"},
"github.com/golang/protobuf/protoc-gen-go/descriptor": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "descriptor_go_proto"},
"github.com/golang/protobuf/ptypes/duration": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "duration_go_proto"},
"github.com/golang/protobuf/ptypes/empty": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "empty_go_proto"},
"google.golang.org/genproto/protobuf/field_mask": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "field_mask_go_proto"},
"google.golang.org/genproto/protobuf/source_context": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "source_context_go_proto"},
"github.com/golang/protobuf/ptypes/struct": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "struct_go_proto"},
"github.com/golang/protobuf/ptypes/timestamp": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "timestamp_go_proto"},
"google.golang.org/genproto/protobuf/ptype": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "type_go_proto"},
"github.com/golang/protobuf/ptypes/wrappers": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "wrappers_go_proto"},
"github.com/golang/protobuf/ptypes/any": label.Label{Repo: "com_github_golang_protobuf", Pkg: "ptypes/any", Name: "any"},
"google.golang.org/genproto/protobuf/api": label.Label{Repo: "org_golang_google_genproto", Pkg: "protobuf/api", Name: "api"},
"github.com/golang/protobuf/protoc-gen-go/plugin": label.Label{Repo: "com_github_golang_protobuf", Pkg: "protoc-gen-go/plugin", Name: "plugin"},
"github.com/golang/protobuf/protoc-gen-go/descriptor": label.Label{Repo: "com_github_golang_protobuf", Pkg: "protoc-gen-go/descriptor", Name: "descriptor"},
"github.com/golang/protobuf/ptypes/duration": label.Label{Repo: "com_github_golang_protobuf", Pkg: "ptypes/duration", Name: "duration"},
"github.com/golang/protobuf/ptypes/empty": label.Label{Repo: "com_github_golang_protobuf", Pkg: "ptypes/empty", Name: "empty"},
"google.golang.org/genproto/protobuf/field_mask": label.Label{Repo: "org_golang_google_genproto", Pkg: "protobuf/field_mask", Name: "field_mask"},
"google.golang.org/genproto/protobuf/source_context": label.Label{Repo: "org_golang_google_genproto", Pkg: "protobuf/source_context", Name: "source_context"},
"github.com/golang/protobuf/ptypes/struct": label.Label{Repo: "com_github_golang_protobuf", Pkg: "ptypes/struct", Name: "struct"},
"github.com/golang/protobuf/ptypes/timestamp": label.Label{Repo: "com_github_golang_protobuf", Pkg: "ptypes/timestamp", Name: "timestamp"},
"google.golang.org/genproto/protobuf/ptype": label.Label{Repo: "org_golang_google_genproto", Pkg: "protobuf/ptype", Name: "ptype"},
"github.com/golang/protobuf/ptypes/wrappers": label.Label{Repo: "com_github_golang_protobuf", Pkg: "ptypes/wrappers", Name: "wrappers"},
}
24 changes: 12 additions & 12 deletions language/proto/known_proto_imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import "github.com/bazelbuild/bazel-gazelle/label"

var knownProtoImports = map[string]label.Label{

"google/protobuf/any.proto": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "any_go_proto"},
"google/protobuf/api.proto": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "api_go_proto"},
"google/protobuf/compiler/plugin.proto": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "compiler_plugin_go_proto"},
"google/protobuf/descriptor.proto": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "descriptor_go_proto"},
"google/protobuf/duration.proto": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "duration_go_proto"},
"google/protobuf/empty.proto": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "empty_go_proto"},
"google/protobuf/field_mask.proto": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "field_mask_go_proto"},
"google/protobuf/source_context.proto": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "source_context_go_proto"},
"google/protobuf/struct.proto": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "struct_go_proto"},
"google/protobuf/timestamp.proto": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "timestamp_go_proto"},
"google/protobuf/type.proto": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "type_go_proto"},
"google/protobuf/wrappers.proto": label.Label{Repo: "io_bazel_rules_go", Pkg: "proto/wkt", Name: "wrappers_go_proto"},
"google/protobuf/any.proto": label.Label{Repo: "com_github_golang_protobuf", Pkg: "ptypes/any", Name: "any"},
"google/protobuf/api.proto": label.Label{Repo: "org_golang_google_genproto", Pkg: "protobuf/api", Name: "api"},
"google/protobuf/compiler/plugin.proto": label.Label{Repo: "com_github_golang_protobuf", Pkg: "protoc-gen-go/plugin", Name: "plugin"},
"google/protobuf/descriptor.proto": label.Label{Repo: "com_github_golang_protobuf", Pkg: "protoc-gen-go/descriptor", Name: "descriptor"},
"google/protobuf/duration.proto": label.Label{Repo: "com_github_golang_protobuf", Pkg: "ptypes/duration", Name: "duration"},
"google/protobuf/empty.proto": label.Label{Repo: "com_github_golang_protobuf", Pkg: "ptypes/empty", Name: "empty"},
"google/protobuf/field_mask.proto": label.Label{Repo: "org_golang_google_genproto", Pkg: "protobuf/field_mask", Name: "field_mask"},
"google/protobuf/source_context.proto": label.Label{Repo: "org_golang_google_genproto", Pkg: "protobuf/source_context", Name: "source_context"},
"google/protobuf/struct.proto": label.Label{Repo: "com_github_golang_protobuf", Pkg: "ptypes/struct", Name: "struct"},
"google/protobuf/timestamp.proto": label.Label{Repo: "com_github_golang_protobuf", Pkg: "ptypes/timestamp", Name: "timestamp"},
"google/protobuf/type.proto": label.Label{Repo: "org_golang_google_genproto", Pkg: "protobuf/ptype", Name: "ptype"},
"google/protobuf/wrappers.proto": label.Label{Repo: "com_github_golang_protobuf", Pkg: "ptypes/wrappers", Name: "wrappers"},
}
24 changes: 12 additions & 12 deletions language/proto/proto.csv
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# This file lists special protos that Gazelle knows how to import. This is used to generate
# code for proto and Go resolvers.
# proto name,proto label,go import path,go proto label
google/protobuf/any.proto,@com_google_protobuf//:any_proto,github.com/golang/protobuf/ptypes/any,@io_bazel_rules_go//proto/wkt:any_go_proto
google/protobuf/api.proto,@com_google_protobuf//:api_proto,google.golang.org/genproto/protobuf/api,@io_bazel_rules_go//proto/wkt:api_go_proto
google/protobuf/compiler/plugin.proto,@com_google_protobuf//:compiler_plugin_proto,github.com/golang/protobuf/protoc-gen-go/plugin,@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto
google/protobuf/descriptor.proto,@com_google_protobuf//:descriptor_proto,github.com/golang/protobuf/protoc-gen-go/descriptor,@io_bazel_rules_go//proto/wkt:descriptor_go_proto
google/protobuf/duration.proto,@com_google_protobuf//:duration_proto,github.com/golang/protobuf/ptypes/duration,@io_bazel_rules_go//proto/wkt:duration_go_proto
google/protobuf/empty.proto,@com_google_protobuf//:empty_proto,github.com/golang/protobuf/ptypes/empty,@io_bazel_rules_go//proto/wkt:empty_go_proto
google/protobuf/field_mask.proto,@com_google_protobuf//:field_mask_proto,google.golang.org/genproto/protobuf/field_mask,@io_bazel_rules_go//proto/wkt:field_mask_go_proto
google/protobuf/source_context.proto,@com_google_protobuf//:source_context_proto,google.golang.org/genproto/protobuf/source_context,@io_bazel_rules_go//proto/wkt:source_context_go_proto
google/protobuf/struct.proto,@com_google_protobuf//:struct_proto,github.com/golang/protobuf/ptypes/struct,@io_bazel_rules_go//proto/wkt:struct_go_proto
google/protobuf/timestamp.proto,@com_google_protobuf//:timestamp_proto,github.com/golang/protobuf/ptypes/timestamp,@io_bazel_rules_go//proto/wkt:timestamp_go_proto
google/protobuf/type.proto,@com_google_protobuf//:type_proto,google.golang.org/genproto/protobuf/ptype,@io_bazel_rules_go//proto/wkt:type_go_proto
google/protobuf/wrappers.proto,@com_google_protobuf//:wrappers_proto,github.com/golang/protobuf/ptypes/wrappers,@io_bazel_rules_go//proto/wkt:wrappers_go_proto
google/protobuf/any.proto,@com_google_protobuf//:any_proto,github.com/golang/protobuf/ptypes/any,@com_github_golang_protobuf//ptypes/any
google/protobuf/api.proto,@com_google_protobuf//:api_proto,google.golang.org/genproto/protobuf/api,@org_golang_google_genproto//protobuf/api
google/protobuf/compiler/plugin.proto,@com_google_protobuf//:compiler_plugin_proto,github.com/golang/protobuf/protoc-gen-go/plugin,@com_github_golang_protobuf//protoc-gen-go/plugin
google/protobuf/descriptor.proto,@com_google_protobuf//:descriptor_proto,github.com/golang/protobuf/protoc-gen-go/descriptor,@com_github_golang_protobuf//protoc-gen-go/descriptor
google/protobuf/duration.proto,@com_google_protobuf//:duration_proto,github.com/golang/protobuf/ptypes/duration,@com_github_golang_protobuf//ptypes/duration
google/protobuf/empty.proto,@com_google_protobuf//:empty_proto,github.com/golang/protobuf/ptypes/empty,@com_github_golang_protobuf//ptypes/empty
google/protobuf/field_mask.proto,@com_google_protobuf//:field_mask_proto,google.golang.org/genproto/protobuf/field_mask,@org_golang_google_genproto//protobuf/field_mask
google/protobuf/source_context.proto,@com_google_protobuf//:source_context_proto,google.golang.org/genproto/protobuf/source_context,@org_golang_google_genproto//protobuf/source_context
google/protobuf/struct.proto,@com_google_protobuf//:struct_proto,github.com/golang/protobuf/ptypes/struct,@com_github_golang_protobuf//ptypes/struct
google/protobuf/timestamp.proto,@com_google_protobuf//:timestamp_proto,github.com/golang/protobuf/ptypes/timestamp,@com_github_golang_protobuf//ptypes/timestamp
google/protobuf/type.proto,@com_google_protobuf//:type_proto,google.golang.org/genproto/protobuf/ptype,@org_golang_google_genproto//protobuf/ptype
google/protobuf/wrappers.proto,@com_google_protobuf//:wrappers_proto,github.com/golang/protobuf/ptypes/wrappers,@com_github_golang_protobuf//ptypes/wrappers
2 changes: 1 addition & 1 deletion language/proto/resolve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ func TestCrossResolve(t *testing.T) {
protoMode: DefaultMode,
imp: resolve.ImportSpec{Lang: "proto", Imp: "google/protobuf/any.proto"},
lang: "go",
want: []resolve.FindResult{{Label: label.New("io_bazel_rules_go", "proto/wkt", "any_go_proto")}},
want: []resolve.FindResult{{Label: label.New("com_github_golang_protobuf", "ptypes/any", "any")}},
},
{
desc: "proto unknown import",
Expand Down

0 comments on commit dcc25e8

Please sign in to comment.