Skip to content

Commit

Permalink
Remove obsolete fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
mering committed Jan 9, 2024
1 parent a972ace commit 8f3cf59
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 50 deletions.
4 changes: 2 additions & 2 deletions cmd/gazelle/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -761,15 +761,15 @@ service TestService {}
Content: `
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_grpc_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
proto_library(
name = "repo_proto",
srcs = ["foo.proto"],
visibility = ["//visibility:public"],
)
go_grpc_library(
go_proto_library(
name = "repo_go_proto",
importpath = "example.com/repo",
proto = ":repo_proto",
Expand Down
13 changes: 0 additions & 13 deletions language/go/fix.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (

func (*goLang) Fix(c *config.Config, f *rule.File) {
migrateLibraryEmbed(c, f)
migrateGrpcCompilers(c, f)
flattenSrcs(c, f)
squashCgoLibrary(c, f)
squashXtest(c, f)
Expand Down Expand Up @@ -171,18 +170,6 @@ func migrateLibraryEmbed(c *config.Config, f *rule.File) {
}
}

// migrateGrpcCompilers converts "go_proto_library" rules with a "compilers"
// attribute containing exactly oldGrpcCompilerLabel into "go_grpc_library" rules.
func migrateGrpcCompilers(c *config.Config, f *rule.File) {
for _, r := range f.Rules {
if r.Kind() != "go_proto_library" || r.ShouldKeep() || r.Attr("compilers") == nil || len(r.AttrStrings("compilers")) != 1 || !strListAttrContains(r, "compilers", oldGrpcCompilerLabel) {
continue
}
r.SetKind("go_grpc_library")
r.DelAttr("compilers")
}
}

// squashCgoLibrary removes cgo_library rules with the default name and
// merges their attributes with go_library with the default name. If no
// go_library rule exists, a new one will be created.
Expand Down
35 changes: 0 additions & 35 deletions language/go/fix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,41 +551,6 @@ gomock(
package = "main",
source = "stripe.go",
)
`,
},
// migrateGrpcCompilers tests
{
desc: "go_proto_library with grpc compilers migrated to go_grpc_library",
old: `load("@io_bazel_rules_go//proto:def.bzl", "go_grpc_library")
proto_library(
name = "foo_proto",
srcs = ["foo.proto"],
visibility = ["//visibility:public"],
)
go_proto_library(
name = "foo_go_proto",
compilers = ["@io_bazel_rules_go//proto:go_grpc"],
importpath = "example.com/repo",
proto = ":foo_proto",
visibility = ["//visibility:public"],
)
`,
want: `load("@io_bazel_rules_go//proto:def.bzl", "go_grpc_library")
proto_library(
name = "foo_proto",
srcs = ["foo.proto"],
visibility = ["//visibility:public"],
)
go_grpc_library(
name = "foo_go_proto",
importpath = "example.com/repo",
proto = ":foo_proto",
visibility = ["//visibility:public"],
)
`,
},
// flattenSrcs tests
Expand Down

0 comments on commit 8f3cf59

Please sign in to comment.