Skip to content

Commit

Permalink
Merge #106544
Browse files Browse the repository at this point in the history
106544: build: don't use `goimports` for `goyacc` r=knz,rail a=rickystewart

We use `goimports` to clean up (add/remove imports) code. This is unnecessary as we know what code we need.

Part of #106541.
Epic: CRDB-8308
Release note: None

Co-authored-by: Ricky Stewart <[email protected]>
  • Loading branch information
craig[bot] and rickystewart committed Jul 11, 2023
2 parents bdaae64 + d2be37f commit 7d6600e
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 18 deletions.
1 change: 0 additions & 1 deletion pkg/sql/lexbase/sql-gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,3 @@ GENYACC=$LANG-gen.y
echo "$ret"; exit 1; \
fi;
rm $GENYACC
$6 -w $4
4 changes: 1 addition & 3 deletions pkg/sql/parser/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,10 @@ export HOME=$(GENDIR)
export GOPATH=/nonexist-gopath
export GOROOT=
$(location :sql-gen) $(location sql.y) sql $(location replace_help_rules.awk) \
$(location sql.go) $(location @org_golang_x_tools//cmd/goyacc) \
$(location @com_github_cockroachdb_gostdlib//x/tools/cmd/goimports) \
$(location sql.go) $(location @org_golang_x_tools//cmd/goyacc)
""",
exec_tools = [
":sql-gen",
"@com_github_cockroachdb_gostdlib//x/tools/cmd/goimports",
"@go_sdk//:bin/go",
"@org_golang_x_tools//cmd/goyacc",
],
Expand Down
4 changes: 1 addition & 3 deletions pkg/sql/parser/sql.y
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,16 @@ package parser

import (
"fmt"
"math"
"strings"

"go/constant"

"github.com/cockroachdb/cockroach/pkg/geo/geopb"
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/security/username"
"github.com/cockroachdb/cockroach/pkg/sql/lexbase"
"github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgcode"
"github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgerror"
"github.com/cockroachdb/cockroach/pkg/sql/privilege"
"github.com/cockroachdb/cockroach/pkg/sql/roleoption"
"github.com/cockroachdb/cockroach/pkg/sql/scanner"
"github.com/cockroachdb/cockroach/pkg/sql/sem/tree"
"github.com/cockroachdb/cockroach/pkg/sql/sem/tree/treebin"
Expand Down
4 changes: 1 addition & 3 deletions pkg/sql/pgrepl/pgreplparser/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ genrule(
cmd = """
export GOPATH=/nonexist-gopath
$(location :pgrepl-gen) $(location pgrepl.y) pgrepl ""\
$(location pgrepl.go) $(location @org_golang_x_tools//cmd/goyacc) \
$(location @com_github_cockroachdb_gostdlib//x/tools/cmd/goimports) \
$(location pgrepl.go) $(location @org_golang_x_tools//cmd/goyacc)
""",
exec_tools = [
":pgrepl-gen",
"@com_github_cockroachdb_gostdlib//x/tools/cmd/goimports",
"@org_golang_x_tools//cmd/goyacc",
],
visibility = ["//visibility:public"],
Expand Down
3 changes: 0 additions & 3 deletions pkg/sql/pgrepl/pgreplparser/pgrepl.y
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@
package pgreplparser

import (
"fmt"

"github.com/cockroachdb/cockroach/pkg/sql/pgrepl/lsn"
"github.com/cockroachdb/cockroach/pkg/sql/pgrepl/pgrepltree"
"github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgcode"
"github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgerror"
"github.com/cockroachdb/cockroach/pkg/sql/sem/tree"
"github.com/cockroachdb/redact"
)
%}

Expand Down
4 changes: 1 addition & 3 deletions pkg/sql/plpgsql/parser/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ genrule(
cmd = """
export GOPATH=/nonexist-gopath
$(location :plpgsql-gen) $(location plpgsql.y) plpgsql ""\
$(location plpgsql.go) $(location @org_golang_x_tools//cmd/goyacc) \
$(location @com_github_cockroachdb_gostdlib//x/tools/cmd/goimports) \
$(location plpgsql.go) $(location @org_golang_x_tools//cmd/goyacc)
""",
exec_tools = [
":plpgsql-gen",
"@com_github_cockroachdb_gostdlib//x/tools/cmd/goimports",
"@org_golang_x_tools//cmd/goyacc",
],
visibility = ["//visibility:public"],
Expand Down
1 change: 0 additions & 1 deletion pkg/sql/plpgsql/parser/plpgsql.y
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
package parser

import (
"github.com/cockroachdb/cockroach/pkg/sql/plpgsql/parser/lexbase"
"github.com/cockroachdb/cockroach/pkg/sql/scanner"
"github.com/cockroachdb/cockroach/pkg/sql/sem/tree"
"github.com/cockroachdb/cockroach/pkg/sql/sem/plpgsqltree"
Expand Down
2 changes: 1 addition & 1 deletion pkg/testutils/lint/lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,7 @@ func TestLint(t *testing.T) {
if pkgSpecified {
skip.IgnoreLint(t, "PKG specified")
}
ignore := `zcgo*|\.(pb(\.gw)?)|(\.[eo]g)\.go|/testdata/|^sql/parser/sql\.go$|(_)?generated(_test)?\.go$`
ignore := `zcgo*|\.(pb(\.gw)?)|(\.[eo]g)\.go|/testdata/|^sql/parser/sql\.go$|(_)?generated(_test)?\.go$|^sql/pgrepl/pgreplparser/pgrepl\.go$|^sql/plpgsql/parser/plpgsql\.go$`
cmd, stderr, filter, err := dirCmd(pkgDir, "crlfmt", "-fast", "-ignore", ignore, "-tab", "2", ".")
if err != nil {
t.Fatal(err)
Expand Down

0 comments on commit 7d6600e

Please sign in to comment.