Skip to content

Commit

Permalink
*: use patched stringer instead of upstream
Browse files Browse the repository at this point in the history
The patched `stringer` is identical to the upstream, except we don't
paste the entire command-line into the generated file. This helps avoid
spurious diffs when doing `dev build --hoist-generated-code`.
See cockroachdb/tools@642e514

Release note: None
  • Loading branch information
rickystewart committed Nov 12, 2021
1 parent ab18b70 commit 403313f
Show file tree
Hide file tree
Showing 53 changed files with 67 additions and 54 deletions.
10 changes: 10 additions & 0 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,16 @@ def go_deps():
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/stress/com_github_cockroachdb_stress-v0.0.0-20170808184505-29b5d31b4c3a.zip",
],
)
go_repository(
name = "com_github_cockroachdb_tools",
build_file_proto_mode = "disable_global",
importpath = "github.com/cockroachdb/tools",
sha256 = "37a3737dd23768b4997b2f0341d625658f5862cdbf808f7fbf3a7f9fd25913a7",
strip_prefix = "github.com/cockroachdb/[email protected]",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/tools/com_github_cockroachdb_tools-v0.0.0-20211112185054-642e51449b40.zip",
],
)
go_repository(
name = "com_github_cockroachdb_ttycolor",
build_file_proto_mode = "disable_global",
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ bin/.bootstrap: $(GITHOOKS) vendor/modules.txt | bin/.submodules-initialized
github.com/cockroachdb/gostdlib/x/tools/cmd/goimports \
github.com/golang/mock/mockgen \
github.com/cockroachdb/stress \
github.com/cockroachdb/tools/cmd/stringer \
github.com/goware/modvendor \
github.com/go-swagger/go-swagger/cmd/swagger \
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \
Expand All @@ -400,7 +401,6 @@ bin/.bootstrap: $(GITHOOKS) vendor/modules.txt | bin/.submodules-initialized
golang.org/x/lint/golint \
golang.org/x/perf/cmd/benchstat \
golang.org/x/tools/cmd/goyacc \
golang.org/x/tools/cmd/stringer \
golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow \
honnef.co/go/tools/cmd/staticcheck \
github.com/bufbuild/buf/cmd/buf
Expand Down
4 changes: 2 additions & 2 deletions build/STRINGER.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ def stringer(src, typ, name):
GO_ABS_PATH=`cd $$GO_REL_PATH && pwd`
# Set GOPATH to something to workaround https://github.com/golang/go/issues/43938
env PATH=$$GO_ABS_PATH HOME=$(GENDIR) GOPATH=/nonexist-gopath \
$(location @org_golang_x_tools//cmd/stringer:stringer) -output=$@ -type={} $<
$(location @com_github_cockroachdb_tools//cmd/stringer:stringer) -output=$@ -type={} $<
""".format(typ),
tools = [
"@go_sdk//:bin/go",
"@org_golang_x_tools//cmd/stringer",
"@com_github_cockroachdb_tools//cmd/stringer",
],
)
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ require (
github.com/cockroachdb/returncheck v0.0.0-20200612231554-92cdbca611dd
github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2
github.com/cockroachdb/stress v0.0.0-20170808184505-29b5d31b4c3a
github.com/cockroachdb/tools v0.0.0-20211112185054-642e51449b40
github.com/cockroachdb/ttycolor v0.0.0-20210902133924-c7d7dcdde4e8
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd
github.com/containerd/containerd v1.5.4
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,8 @@ github.com/cockroachdb/tablewriter v0.0.5-0.20200105123400-bd15540e8847 h1:c7yLg
github.com/cockroachdb/tablewriter v0.0.5-0.20200105123400-bd15540e8847/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA=
github.com/cockroachdb/teamcity v0.0.0-20180905144921-8ca25c33eb11 h1:UAqRo5xPCyTtZznAJ9iPVpDUFxGI0a6QWtQ8E+zwJRg=
github.com/cockroachdb/teamcity v0.0.0-20180905144921-8ca25c33eb11/go.mod h1:3299Mt0Q7PkqGqbsxhvbrTpMqRyIcZ6OMw4IEmiO09g=
github.com/cockroachdb/tools v0.0.0-20211112185054-642e51449b40 h1:qVTb3XEv+7VVjPetop8yGbN95HfCeqZx+VMveeSJPZw=
github.com/cockroachdb/tools v0.0.0-20211112185054-642e51449b40/go.mod h1:cllxeV+TYc387/XzQRnDg6YThHoDzFewovWffzAm37Q=
github.com/cockroachdb/ttycolor v0.0.0-20180709150743-a1d5aaeb377d/go.mod h1:NltwFG0VBANi1jHKpn5KL9AbsHTE+8fPaAHT0TzL20k=
github.com/cockroachdb/ttycolor v0.0.0-20210902133924-c7d7dcdde4e8 h1:Hli+oX84dKq44sLVCcsGKqifm5Lg9J8VoJ2P3h9iPdI=
github.com/cockroachdb/ttycolor v0.0.0-20210902133924-c7d7dcdde4e8/go.mod h1:75wnig8+TF6vst9hChkpcFO7YrRLddouJ5is8uqpfv0=
Expand Down
2 changes: 1 addition & 1 deletion pkg/base/testclusterreplicationmode_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/ccl/sqlproxyccl/errorcode_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/cli/keytype_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/clusterversion/key_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/cmd/import-tools/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
_ "github.com/cockroachdb/gostdlib/cmd/gofmt"
_ "github.com/cockroachdb/gostdlib/x/tools/cmd/goimports"
_ "github.com/cockroachdb/stress"
_ "github.com/cockroachdb/tools/cmd/stringer"
_ "github.com/go-swagger/go-swagger/cmd/swagger"
_ "github.com/golang/mock/mockgen"
_ "github.com/goware/modvendor"
Expand All @@ -41,7 +42,6 @@ import (
_ "golang.org/x/lint/golint"
_ "golang.org/x/perf/cmd/benchstat"
_ "golang.org/x/tools/cmd/goyacc"
_ "golang.org/x/tools/cmd/stringer"
_ "golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow"
_ "honnef.co/go/tools/cmd/staticcheck"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/txnstate_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/kv/kvserver/refreshraftreason_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/roachpb/errordetailtype_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/roachpb/method_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/advancecode_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/catalog/descpb/formatversion_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/catalog/descpb/privilegedescversion_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/colfetcher/fetcherstate_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/execinfra/consumerstatus_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/execinfra/procstate_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/nodestatus_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/sql/opt/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ genrule(
GO_ABS_PATH=`cd $$GO_REL_PATH && pwd`
# Set GOPATH to something to workaround https://github.com/golang/go/issues/43938
env PATH=$$GO_ABS_PATH HOME=$(GENDIR) GOPATH=/nonexist-gopath \
$(location @org_golang_x_tools//cmd/stringer:stringer) -output=$@ \
$(location @com_github_cockroachdb_tools//cmd/stringer:stringer) -output=$@ \
-type=RuleName `dirname $(location :gen-rulenames)`/rule_name.go $(location :gen-rulenames)
""",
exec_tools = [
"@go_sdk//:bin/go",
"@org_golang_x_tools//cmd/stringer",
"@com_github_cockroachdb_tools//cmd/stringer",
],
)
2 changes: 1 addition & 1 deletion pkg/sql/opt/optgen/lang/operator_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/opt/optgen/lang/token_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/pgwire/pgwirebase/clientmessagetype_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/pgwire/pgwirebase/formatcode_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/pgwire/pgwirebase/pgnumericsign_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/pgwire/pgwirebase/preparetype_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/pgwire/pgwirebase/servererrfieldtype_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/pgwire/pgwirebase/servermessagetype_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/privilege/kind_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/roleoption/option_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/sql/schemachange/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ genrule(
GO_ABS_PATH=`cd $$GO_REL_PATH && pwd`
# Set GOPATH to something to workaround https://github.com/golang/go/issues/43938
env PATH=$$GO_ABS_PATH HOME=$(GENDIR) GOPATH=/nonexist-gopath \
$(location @org_golang_x_tools//cmd/stringer:stringer) -output=$@ -type=ColumnConversionKind -trimprefix ColumnConversion $<
$(location @com_github_cockroachdb_tools//cmd/stringer:stringer) -output=$@ -type=ColumnConversionKind -trimprefix ColumnConversion $<
""",
exec_tools = [
"@go_sdk//:bin/go",
"@org_golang_x_tools//cmd/stringer",
"@com_github_cockroachdb_tools//cmd/stringer",
],
)
2 changes: 1 addition & 1 deletion pkg/sql/schemachange/columnconversionkind_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/schemachanger/rel/systemattribute_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/schemachanger/scop/phase_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/schemachanger/scop/type_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/schemachanger/screl/attr_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/sem/tree/createtypevariety_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/sem/tree/statementreturntype_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/sem/tree/statementtype_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/txnevent_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/sql/txntype_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/storage/resourcelimitreached_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/util/encoding/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ genrule(
# Set GOPATH to something to workaround https://github.com/golang/go/issues/43938
sed -e 's/type Type encodingtype.T/type Type int/' $(location encoding.go) > encoding_tmp.go && \
env PATH=$$GO_ABS_PATH HOME=$(GENDIR) GOPATH=/nonexist-gopath \
$(location @org_golang_x_tools//cmd/stringer:stringer) -output=$@ -type=Type encoding_tmp.go
$(location @com_github_cockroachdb_tools//cmd/stringer:stringer) -output=$@ -type=Type encoding_tmp.go
""",
exec_tools = [
"@go_sdk//:bin/go",
"@org_golang_x_tools//cmd/stringer",
"@com_github_cockroachdb_tools//cmd/stringer",
],
)
2 changes: 1 addition & 1 deletion pkg/util/encoding/type_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/util/timeutil/pgdate/field_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/workload/schemachange/optype_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 403313f

Please sign in to comment.