From 1530ace14bcf5daaf48e39158d3d744822f6a8f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20R=C3=BCger?= Date: Fri, 15 Aug 2025 17:34:20 +0200 Subject: [PATCH] chore: Use go tool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Manuel RĂ¼ger --- Makefile | 20 ++++++-------------- go.mod | 10 ++++++++++ go.sum | 10 ++++++++++ scripts/compare_benchmarks.sh | 6 +++--- scripts/fix.sh | 2 +- 5 files changed, 30 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index eb4393dad..b1062cabe 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ fmt: @!(gofmt -l -s -d ${GOFILES} | grep '[a-z]') @echo "Verifying goimports, failures can be fixed with ./scripts/fix.sh" - @!(go run golang.org/x/tools/cmd/goimports@latest -l -d ${GOFILES} | grep '[a-z]') + @!(go tool golang.org/x/tools/cmd/goimports -l -d ${GOFILES} | grep '[a-z]') .PHONY: lint lint: @@ -71,16 +71,12 @@ clean: # Clean binaries rm -f ./bin/${BOLT_CMD} .PHONY: gofail-enable -gofail-enable: install-gofail - gofail enable . +gofail-enable: + go tool go.etcd.io/gofail enable . .PHONY: gofail-disable -gofail-disable: install-gofail - gofail disable . - -.PHONY: install-gofail -install-gofail: - go install go.etcd.io/gofail +gofail-disable: + go tool go.etcd.io/gofail disable . .PHONY: test-failpoint test-failpoint: @@ -99,10 +95,6 @@ test-robustness: gofail-enable build .PHONY: test-benchmark-compare # Runs benchmark tests on the current git ref and the given REF, and compares # the two. -test-benchmark-compare: install-benchstat +test-benchmark-compare: @git fetch ./scripts/compare_benchmarks.sh $(REF) - -.PHONY: install-benchstat -install-benchstat: - go install golang.org/x/perf/cmd/benchstat@latest diff --git a/go.mod b/go.mod index f6d0a1abc..255fd5c52 100644 --- a/go.mod +++ b/go.mod @@ -14,8 +14,18 @@ require ( ) require ( + github.com/aclements/go-moremath v0.0.0-20210112150236-f10218a38794 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + golang.org/x/mod v0.27.0 // indirect + golang.org/x/perf v0.0.0-20250813145418-2f7363a06fe1 // indirect + golang.org/x/tools v0.36.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +tool ( + go.etcd.io/gofail + golang.org/x/perf/cmd/benchstat + golang.org/x/tools/cmd/goimports +) diff --git a/go.sum b/go.sum index 3484269ab..1056bcf8e 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,10 @@ +github.com/aclements/go-moremath v0.0.0-20210112150236-f10218a38794 h1:xlwdaKcTNVW4PtpQb8aKA4Pjy0CdJHEqvFbAnvR5m2g= +github.com/aclements/go-moremath v0.0.0-20210112150236-f10218a38794/go.mod h1:7e+I0LQFUI9AXWxOfsQROs9xPhoJtbsyWcjJqDd4KPY= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -15,10 +19,16 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= go.etcd.io/gofail v0.2.0 h1:p19drv16FKK345a09a1iubchlw/vmRuksmRzgBIGjcA= go.etcd.io/gofail v0.2.0/go.mod h1:nL3ILMGfkXTekKI3clMBNazKnjUZjYLKmBHzsVAnC1o= +golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ= +golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc= +golang.org/x/perf v0.0.0-20250813145418-2f7363a06fe1 h1:stGRioFgvBd3x8HoGVg9bb41lLTWLjBMFT/dMB7f4mQ= +golang.org/x/perf v0.0.0-20250813145418-2f7363a06fe1/go.mod h1:rjfRjhHXb3XNVh/9i5Jr2tXoTd0vOlZN5rzsM8cQE6k= golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= +golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/scripts/compare_benchmarks.sh b/scripts/compare_benchmarks.sh index af397cb44..6d76249f0 100755 --- a/scripts/compare_benchmarks.sh +++ b/scripts/compare_benchmarks.sh @@ -57,12 +57,12 @@ function main() { echo "BASE=${BASE_TO_COMPARE} HEAD=${REF_CURRENT}" if [[ "${BENCHSTAT_FORMAT}" == "csv" ]]; then - benchstat -format=csv -confidence="${BENCHSTAT_CONFIDENCE_LEVEL}" BASE="${RESULT_TO_COMPARE}" HEAD="${RESULT_CURRENT}" 2>/dev/null 1>"${BENCHSTAT_OUTPUT_FILE}" + go tool golang.org/x/perf/cmd/benchstat -format=csv -confidence="${BENCHSTAT_CONFIDENCE_LEVEL}" BASE="${RESULT_TO_COMPARE}" HEAD="${RESULT_CURRENT}" 2>/dev/null 1>"${BENCHSTAT_OUTPUT_FILE}" else if [[ -z "${BENCHSTAT_OUTPUT_FILE}" ]]; then - benchstat -confidence="${BENCHSTAT_CONFIDENCE_LEVEL}" BASE="${RESULT_TO_COMPARE}" HEAD="${RESULT_CURRENT}" + go tool golang.org/x/perf/cmd/benchstat -confidence="${BENCHSTAT_CONFIDENCE_LEVEL}" BASE="${RESULT_TO_COMPARE}" HEAD="${RESULT_CURRENT}" else - benchstat -confidence="${BENCHSTAT_CONFIDENCE_LEVEL}" BASE="${RESULT_TO_COMPARE}" HEAD="${RESULT_CURRENT}" 1>"${BENCHSTAT_OUTPUT_FILE}" + go tool golang.org/x/perf/cmd/benchstat -confidence="${BENCHSTAT_CONFIDENCE_LEVEL}" BASE="${RESULT_TO_COMPARE}" HEAD="${RESULT_CURRENT}" 1>"${BENCHSTAT_OUTPUT_FILE}" fi fi } diff --git a/scripts/fix.sh b/scripts/fix.sh index 6b933c988..13309dbaf 100755 --- a/scripts/fix.sh +++ b/scripts/fix.sh @@ -7,7 +7,7 @@ TESTGOFILES=$(${GO_CMD} list --f "{{with \$d:=.}}{{range .TestGoFiles}}{{\$d.Di XTESTGOFILES=$(${GO_CMD} list --f "{{with \$d:=.}}{{range .XTestGoFiles}}{{\$d.Dir}}/{{.}}{{\"\n\"}}{{end}}{{end}}" ./...) -echo "${GOFILES}" "${TESTGOFILES}" "${XTESTGOFILES}"| xargs -n 100 go run golang.org/x/tools/cmd/goimports@latest -w -local go.etcd.io +echo "${GOFILES}" "${TESTGOFILES}" "${XTESTGOFILES}"| xargs -n 100 go tool golang.org/x/tools/cmd/goimports -w -local go.etcd.io go fmt ./... go mod tidy