diff --git a/.circleci/config.yml b/.circleci/config.yml index b9ac9f3faf..47c54212d8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -597,12 +597,11 @@ commands: GOLANG_VERSION=$(./scripts/get_golang_version.sh) eval "$(<< parameters.build_dir >>/gimme "${GOLANG_VERSION}")" scripts/configure_dev.sh - scripts/buildtools/install_buildtools.sh -o "gotest.tools/gotestsum" PACKAGES="$(go list ./... | grep -v /go-algorand/test/)" export PACKAGE_NAMES=$(echo $PACKAGES | tr -d '\n') export PARTITION_TOTAL=${CIRCLE_NODE_TOTAL} export PARTITION_ID=${CIRCLE_NODE_INDEX} - gotestsum --format standard-verbose --junitfile << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/results.xml --jsonfile << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/testresults.json -- --tags "sqlite_unlock_notify sqlite_omit_load_extension" << parameters.short_test_flag >> -race -timeout 1h -coverprofile=coverage.txt -covermode=atomic -p 1 $PACKAGE_NAMES + go run gotest.tools/gotestsum@v1.10.0 --format standard-verbose --junitfile << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/results.xml --jsonfile << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/testresults.json -- --tags "sqlite_unlock_notify sqlite_omit_load_extension" << parameters.short_test_flag >> -race -timeout 1h -coverprofile=coverage.txt -covermode=atomic -p 1 $PACKAGE_NAMES - store_artifacts: path: << parameters.result_path >> destination: test-results @@ -663,7 +662,6 @@ commands: GOLANG_VERSION=$(./scripts/get_golang_version.sh) eval "$(<< parameters.build_dir >>/gimme "${GOLANG_VERSION}")" scripts/configure_dev.sh - scripts/buildtools/install_buildtools.sh -o "gotest.tools/gotestsum" export ALGOTEST=1 export SHORTTEST=<< parameters.short_test_flag >> export TEST_RESULTS=<< parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX} diff --git a/Makefile b/Makefile index 8301771718..5916993d85 100644 --- a/Makefile +++ b/Makefile @@ -35,12 +35,7 @@ GOTAGSLIST := sqlite_unlock_notify sqlite_omit_load_extension # e.g. make GOTAGSCUSTOM=msgtrace GOTAGSLIST += ${GOTAGSCUSTOM} -# If available, use gotestsum instead of 'go test'. -ifeq (, $(shell which gotestsum)) -export GOTESTCOMMAND=go test -else -export GOTESTCOMMAND=gotestsum --format pkgname --jsonfile testresults.json -- -endif +export GOTESTCOMMAND=go run gotest.tools/gotestsum@v1.10.0 --format pkgname --jsonfile testresults.json -- # M1 Mac--homebrew install location in /opt/homebrew ifeq ($(OS_TYPE), darwin) @@ -99,8 +94,8 @@ fmt: fix: build $(GOPATH1)/bin/algofix */ -lint: deps - $(GOPATH1)/bin/golangci-lint run -c .golangci.yml +lint: + go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.2 run -c .golangci.yml check_go_version: @if [ $(CURRENT_GO_VERSION_MAJOR) != $(GOLANG_VERSION_BUILD_MAJOR) ]; then \ @@ -127,17 +122,18 @@ cover: prof: cd node && go test $(GOTAGS) -cpuprofile=cpu.out -memprofile=mem.out -mutexprofile=mutex.out -generate: deps +generate: PATH=$(GOPATH1)/bin:$$PATH go generate ./... msgp: $(patsubst %,%/msgp_gen.go,$(MSGP_GENERATE)) -%/msgp_gen.go: deps ALWAYS +MSGP := go run github.com/algorand/msgp@v1.1.60 +%/msgp_gen.go: ALWAYS @set +e; \ printf "msgp: $(@D)..."; \ - $(GOPATH1)/bin/msgp -file ./$(@D) -o $@ -warnmask github.com/algorand/go-algorand > ./$@.out 2>&1; \ + $(MSGP) -file ./$(@D) -o $@ -warnmask github.com/algorand/go-algorand > ./$@.out 2>&1; \ if [ "$$?" != "0" ]; then \ - printf "failed:\n$(GOPATH1)/bin/msgp -file ./$(@D) -o $@ -warnmask github.com/algorand/go-algorand\n"; \ + printf "failed:\n$(MSGP) -file ./$(@D) -o $@ -warnmask github.com/algorand/go-algorand\n"; \ cat ./$@.out; \ rm ./$@.out; \ exit 1; \ @@ -157,9 +153,6 @@ crypto/libs/$(OS_TYPE)/$(ARCH)/lib/libsodium.a: $(MAKE) && \ $(MAKE) install -deps: - ./scripts/check_deps.sh - # artifacts # Regenerate kmd swagger spec files diff --git a/README.md b/README.md index 6925f02225..3e46c3777e 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,6 @@ Initial environment setup: git clone https://github.com/algorand/go-algorand cd go-algorand ./scripts/configure_dev.sh -./scripts/buildtools/install_buildtools.sh ``` At this point, you are ready to build go-algorand. We use `make` and have a diff --git a/agreement/actions.go b/agreement/actions.go index 9a6fa7138e..89e9801d19 100644 --- a/agreement/actions.go +++ b/agreement/actions.go @@ -26,7 +26,7 @@ import ( "github.com/algorand/go-algorand/protocol" ) -//go:generate stringer -type=actionType +//go:generate go run golang.org/x/tools/cmd/stringer@v0.17.0 -type=actionType type actionType uint8 const ( diff --git a/agreement/coservice.go b/agreement/coservice.go index 7def929c15..9355639e99 100644 --- a/agreement/coservice.go +++ b/agreement/coservice.go @@ -22,7 +22,7 @@ import ( "github.com/algorand/go-algorand/logging" ) -//go:generate stringer -type=coserviceType +//go:generate go run golang.org/x/tools/cmd/stringer@v0.17.0 -type=coserviceType const ( demuxCoserviceType coserviceType = iota tokenizerCoserviceType diff --git a/agreement/events.go b/agreement/events.go index f8d8eca475..447f859275 100644 --- a/agreement/events.go +++ b/agreement/events.go @@ -70,7 +70,7 @@ type externalEvent interface { // interface. The semantics of an event depends on the eventType and not on the // type of the implementing struct. // -//go:generate stringer -type=eventType +//go:generate go run golang.org/x/tools/cmd/stringer@v0.17.0 -type=eventType type eventType uint8 const ( diff --git a/agreement/router.go b/agreement/router.go index fa7e8dd634..2807641e1b 100644 --- a/agreement/router.go +++ b/agreement/router.go @@ -27,7 +27,7 @@ import ( //msgp:ignore stateMachineTag type stateMachineTag int -//go:generate stringer -type=stateMachineTag +//go:generate go run golang.org/x/tools/cmd/stringer@v0.17.0 -type=stateMachineTag const ( demultiplexer stateMachineTag = iota // type demux diff --git a/daemon/algod/api/Makefile b/daemon/algod/api/Makefile index c4104d9e80..a2ceee89c4 100644 --- a/daemon/algod/api/Makefile +++ b/daemon/algod/api/Makefile @@ -1,42 +1,37 @@ -GOPATH := $(shell go env GOPATH) -GOPATH1 := $(firstword $(subst :, ,$(GOPATH))) - # `make all` or just `make` should be appropriate for dev work all: server/v2/generated/model/types.go server/v2/generated/nonparticipating/public/routes.go server/v2/generated/nonparticipating/private/routes.go server/v2/generated/participating/public/routes.go server/v2/generated/participating/private/routes.go server/v2/generated/data/routes.go server/v2/generated/experimental/routes.go # `make generate` should be able to replace old `generate.sh` script and be appropriate for build system use -generate: oapi-codegen all +generate: all +CODEGEN := go run github.com/algorand/oapi-codegen/cmd/oapi-codegen@v1.12.0-algorand.0 server/v2/generated/nonparticipating/public/routes.go: algod.oas3.yml - $(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/nonparticipating/public/public_routes.yml algod.oas3.yml + $(CODEGEN) -config ./server/v2/generated/nonparticipating/public/public_routes.yml algod.oas3.yml server/v2/generated/nonparticipating/private/routes.go: algod.oas3.yml - $(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/nonparticipating/private/private_routes.yml algod.oas3.yml + $(CODEGEN) -config ./server/v2/generated/nonparticipating/private/private_routes.yml algod.oas3.yml server/v2/generated/participating/public/routes.go: algod.oas3.yml - $(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/participating/public/public_routes.yml algod.oas3.yml + $(CODEGEN) -config ./server/v2/generated/participating/public/public_routes.yml algod.oas3.yml server/v2/generated/participating/private/routes.go: algod.oas3.yml - $(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/participating/private/private_routes.yml algod.oas3.yml + $(CODEGEN) -config ./server/v2/generated/participating/private/private_routes.yml algod.oas3.yml server/v2/generated/data/routes.go: algod.oas3.yml - $(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/data/data_routes.yml algod.oas3.yml + $(CODEGEN) -config ./server/v2/generated/data/data_routes.yml algod.oas3.yml server/v2/generated/experimental/routes.go: algod.oas3.yml - $(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/experimental/experimental_routes.yml algod.oas3.yml + $(CODEGEN) -config ./server/v2/generated/experimental/experimental_routes.yml algod.oas3.yml server/v2/generated/model/types.go: algod.oas3.yml - $(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/model/model_types.yml algod.oas3.yml + $(CODEGEN) -config ./server/v2/generated/model/model_types.yml algod.oas3.yml algod.oas3.yml: algod.oas2.json curl -s -X POST "https://converter.swagger.io/api/convert" -H "accept: application/json" -H "Content-Type: application/json" -d @./algod.oas2.json -o .3tmp.json python3 jsoncanon.py < .3tmp.json > algod.oas3.yml rm -f .3tmp.json -oapi-codegen: .PHONY - ../../../scripts/buildtools/install_buildtools.sh -o github.com/algorand/oapi-codegen -c github.com/algorand/oapi-codegen/cmd/oapi-codegen - clean: rm -rf server/v2/generated/model/types.go server/v2/generated/nonparticipating/public/routes.go server/v2/generated/nonparticipating/private/routes.go server/v2/generated/participating/public/routes.go server/v2/generated/participating/private/routes.go server/v2/generated/data/routes.go algod.oas3.yml diff --git a/daemon/kmd/api/api.go b/daemon/kmd/api/api.go index 084b6f882b..f64e2aa57d 100644 --- a/daemon/kmd/api/api.go +++ b/daemon/kmd/api/api.go @@ -59,8 +59,8 @@ // Base path must be a fully specified package name (else, it seems that swagger feeds a relative path to // loader.Config.Import(), and that breaks the vendor directory if the source is symlinked from elsewhere) // -//go:generate swagger generate spec -m -o="./swagger.json" -//go:generate swagger validate ./swagger.json --stop-on-error +//go:generate go run github.com/go-swagger/go-swagger/cmd/swagger@v0.30.5 generate spec -m -o="./swagger.json" +//go:generate go run github.com/go-swagger/go-swagger/cmd/swagger@v0.30.5 validate ./swagger.json --stop-on-error //go:generate sh ../lib/kmdapi/bundle_swagger_json.sh package api @@ -70,7 +70,7 @@ import ( "github.com/gorilla/mux" - "github.com/algorand/go-algorand/daemon/kmd/api/v1" + v1 "github.com/algorand/go-algorand/daemon/kmd/api/v1" "github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi" "github.com/algorand/go-algorand/daemon/kmd/session" "github.com/algorand/go-algorand/logging" diff --git a/data/transactions/application.go b/data/transactions/application.go index 48a5788c04..0a9ebb7e04 100644 --- a/data/transactions/application.go +++ b/data/transactions/application.go @@ -58,7 +58,7 @@ const ( // OnCompletion is an enum representing some layer 1 side effect that an // ApplicationCall transaction will have if it is included in a block. // -//go:generate stringer -type=OnCompletion -output=application_string.go +//go:generate go run golang.org/x/tools/cmd/stringer@v0.17.0 -type=OnCompletion -output=application_string.go type OnCompletion uint64 const ( diff --git a/data/transactions/logic/fields.go b/data/transactions/logic/fields.go index a2f971f7b7..c201f652f9 100644 --- a/data/transactions/logic/fields.go +++ b/data/transactions/logic/fields.go @@ -23,7 +23,7 @@ import ( "github.com/algorand/go-algorand/protocol" ) -//go:generate stringer -type=TxnField,GlobalField,AssetParamsField,AppParamsField,AcctParamsField,AssetHoldingField,OnCompletionConstType,EcdsaCurve,EcGroup,Base64Encoding,JSONRefType,VrfStandard,BlockField -output=fields_string.go +//go:generate go run golang.org/x/tools/cmd/stringer@v0.17.0 -type=TxnField,GlobalField,AssetParamsField,AppParamsField,AcctParamsField,AssetHoldingField,OnCompletionConstType,EcdsaCurve,EcGroup,Base64Encoding,JSONRefType,VrfStandard,BlockField -output=fields_string.go // FieldSpec unifies the various specs for assembly, disassembly, and doc generation. type FieldSpec interface { diff --git a/docs/messagepack.md b/docs/messagepack.md index c81c19fde0..94b2d87ddd 100644 --- a/docs/messagepack.md +++ b/docs/messagepack.md @@ -32,7 +32,7 @@ idea of the performance difference, [here are some benchmarks for Transactions]( ## Code generation -Install `msgp` with [install_buildtools.sh](scripts/buildtools/install_buildtools.sh) and use it with `make msgp`. +Generate messagepack code with `make msgp`. The generated Marshal and Unmarshal utilities are located in `msgp_gen.go` files. Update `MSGP_GENERATE` in the Makefile to add another package. diff --git a/ledger/store/trackerdb/hashing.go b/ledger/store/trackerdb/hashing.go index 4a0122436f..a477cfd593 100644 --- a/ledger/store/trackerdb/hashing.go +++ b/ledger/store/trackerdb/hashing.go @@ -29,7 +29,7 @@ import ( // By encoding HashKind at a known-offset, it's possible for hash readers to // disambiguate the hashed resource. // -//go:generate stringer -type=HashKind +//go:generate go run golang.org/x/tools/cmd/stringer@v0.17.0 -type=HashKind //msgp:ignore HashKind type HashKind byte diff --git a/logging/logspec/agreement.go b/logging/logspec/agreement.go index cb5d978afc..9221870cd6 100644 --- a/logging/logspec/agreement.go +++ b/logging/logspec/agreement.go @@ -24,7 +24,7 @@ import ( // AgreementType is an enum identifying a specific type of AgreementEvent // TODO Maybe this should be called AgreementEventType, since these are not actually types of agreements // -//go:generate stringer -type=AgreementType +//go:generate go run golang.org/x/tools/cmd/stringer@v0.17.0 -type=AgreementType type AgreementType int const ( diff --git a/logging/logspec/ledger.go b/logging/logspec/ledger.go index d04b2087f7..430f331de2 100644 --- a/logging/logspec/ledger.go +++ b/logging/logspec/ledger.go @@ -24,7 +24,7 @@ import ( // LedgerType is an enum identifying a specific type of LedgerEvent // TODO Maybe this should be called LedgerEventType, since these are not actually types of ledgers // -//go:generate stringer -type=LedgerType +//go:generate go run golang.org/x/tools/cmd/stringer@v0.17.0 -type=LedgerType type LedgerType int const ( diff --git a/logging/logspec/root.go b/logging/logspec/root.go index a089c650d3..ef9ae039a8 100644 --- a/logging/logspec/root.go +++ b/logging/logspec/root.go @@ -26,7 +26,7 @@ import ( // TODO Maybe this should be called ComponentEventType (and change Event to ComponentEvent), // since these are not actually types of components // -//go:generate stringer -type=Component +//go:generate go run golang.org/x/tools/cmd/stringer@v0.17.0 -type=Component type Component int const ( diff --git a/scripts/buildtools/install_buildtools.sh b/scripts/buildtools/install_buildtools.sh deleted file mode 100755 index 7a004851a1..0000000000 --- a/scripts/buildtools/install_buildtools.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/env bash -# shellcheck disable=2181 - -set -exo pipefail - -BUILDTOOLS_INSTALL=ALL - -function usage { - echo "$0 is used to install go build tools." - echo "By default all packages are installed." - echo "usage: $0 [-o packagename]" - echo " -o packagename when used only packagename is installed." - echo " -c commandname if it is one command from a package provide this." - echo " -h print this usage information." -} - -while getopts ":o:c:h" opt; do - case $opt in - o) - BUILDTOOLS_INSTALL="$OPTARG" - ;; - c) - BUILDTOOLS_COMMAND="$OPTARG" - ;; - h) - usage - exit 0 - ;; - \?) - echo "Invalid option: -$OPTARG" >&2 - usage - exit 1 - ;; - :) - echo "Option -$OPTARG requires an argument." >&2 - usage - exit 1 - ;; - esac -done -shift $((OPTIND -1)) - -if [ "$#" -ne 0 ]; then - echo "Unexpected positional arguments passed to script: $@" - exit 1 -fi - - -SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" -pushd . -cd ${SCRIPTPATH} -(cd ../..; ${SCRIPTPATH}/../check_golang_version.sh dev) - -function get_go_version { - cd "${SCRIPTPATH}" - VERSION=$( grep "$1" 2>/dev/null < ./versions | awk -F " " '{print $2}') - echo "$VERSION" - return -} - -function install_go_module { - local OUTPUT - local MODULE - if [[ "$2" != "" ]]; then - MODULE=$2 - else - MODULE=$1 - fi - - # Check for version - VERSION=$(get_go_version "$1") - - if [ -z "$VERSION" ]; then - echo "Unable to install requested package '$1' (${MODULE}): no version listed in ${SCRIPTPATH}/versions" - exit 1 - else - OUTPUT=$(go install "${MODULE}@${VERSION}" 2>&1) - fi - if [ $? != 0 ]; then - echo "error: executing \"go install ${MODULE}\" failed : ${OUTPUT}" - exit 1 - fi -} - -if [[ "${BUILDTOOLS_INSTALL}" != "ALL" ]]; then - install_go_module "${BUILDTOOLS_INSTALL}" "${BUILDTOOLS_COMMAND}" - exit 0 -fi - -install_go_module golang.org/x/tools golang.org/x/tools/cmd/stringer -install_go_module github.com/go-swagger/go-swagger github.com/go-swagger/go-swagger/cmd/swagger -install_go_module github.com/algorand/msgp -install_go_module gotest.tools/gotestsum -install_go_module github.com/algorand/oapi-codegen github.com/algorand/oapi-codegen/cmd/oapi-codegen -install_go_module github.com/golangci/golangci-lint/cmd/golangci-lint diff --git a/scripts/buildtools/versions b/scripts/buildtools/versions deleted file mode 100644 index ba43b37f60..0000000000 --- a/scripts/buildtools/versions +++ /dev/null @@ -1,7 +0,0 @@ -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 -golang.org/x/tools v0.9.3 -github.com/algorand/msgp v1.1.60 -github.com/algorand/oapi-codegen v1.12.0-algorand.0 -github.com/go-swagger/go-swagger v0.30.4 -gotest.tools/gotestsum v1.10.0 -github.com/golangci/golangci-lint/cmd/golangci-lint v1.53.2 diff --git a/scripts/check_deps.sh b/scripts/check_deps.sh deleted file mode 100755 index 4022bb544b..0000000000 --- a/scripts/check_deps.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env bash - -# check_deps.sh - Quickly(!) checks the enlistment for any missing dependencies and attempts to resolve them. -# Reports if any dependencies are still missing after attempts to resolve. -# -# Syntax: check_deps.sh -# -# Outputs: status messages -# -# ExitCode: 0 = All dependencies resolved / present -# -# Usage: Use before building to ensure dependencies are present (should be nop except after dependencies change) -# -# Examples: scripts/check_deps.sh - -GREEN_FG=$(tput setaf 2 2>/dev/null) -RED_FG=$(tput setaf 1 2>/dev/null) -TEAL_FG=$(tput setaf 6 2>/dev/null) -YELLOW_FG=$(tput setaf 3 2>/dev/null) -END_FG_COLOR=$(tput sgr0 2>/dev/null) - -UNAME=$(uname) -if [[ "${UNAME}" == *"MINGW"* ]]; then - GOPATH=$HOME/go -else - GOPATH=$(go env GOPATH) -fi -export GOPATH -GO_BIN="$(echo "$GOPATH" | cut -d: -f1)/bin" -MISSING=0 - -missing_dep() { - echo "$YELLOW_FG[WARNING]$END_FG_COLOR Missing dependency \`$TEAL_FG${1}$END_FG_COLOR\`." - MISSING=1 -} - -GO_DEPS=( - "msgp" - "golangci-lint" - "oapi-codegen" - "swagger" -) - -check_go_binary_version() { - binary_name=$1 - expected_version=$(grep "$binary_name" scripts/buildtools/versions | awk '{print $2}') - actual_version=$(go version -m "$GO_BIN/$binary_name" | awk 'NR==3 {print $3}') - - if [ "$expected_version" != "$actual_version" ]; then - echo "$YELLOW_FG[WARNING]$END_FG_COLOR $binary_name version mismatch, expected $expected_version, but got $actual_version" - echo "Use 'install_buildtools.sh' to fix." - fi -} - -check_deps() { - for dep in ${GO_DEPS[*]} - do - if [ ! -f "$GO_BIN/$dep" ] - then - # Parameter expansion is faster than invoking another process. - # https://www.linuxjournal.com/content/bash-parameter-expansion - missing_dep "${dep##*/}" - fi - - # go 1.17 on arm64 macs has an issue checking binaries with "go version", skip version check - if [[ "$(uname)" != "Darwin" ]] || [[ "$(uname -m)" != "arm64" ]] || ! [[ "$(go version | awk '{print $3}')" < "go1.17" ]] - then - check_go_binary_version "$dep" - fi - done - - # Don't print `shellcheck`s location. - if ! which shellcheck > /dev/null - then - missing_dep shellcheck - fi -} - -check_deps - -if [ $MISSING -eq 0 ] -then - echo "$GREEN_FG[$0]$END_FG_COLOR Required dependencies installed." -else - echo -e "$RED_FG[$0]$END_FG_COLOR Required dependencies missing. Run \`${TEAL_FG}./scripts/configure_dev.sh$END_FG_COLOR\` and/or \`${TEAL_FG}./scripts/buildtools/install_buildtools.sh$END_FG_COLOR\` to install." - exit 1 -fi - diff --git a/scripts/travis/codegen_verification.sh b/scripts/travis/codegen_verification.sh index 53ad607a49..9fbb6b0c83 100755 --- a/scripts/travis/codegen_verification.sh +++ b/scripts/travis/codegen_verification.sh @@ -23,8 +23,6 @@ GOLANG_VERSION=$(./scripts/get_golang_version.sh) eval "$(~/gimme "${GOLANG_VERSION}")" -"${SCRIPTPATH}"/../buildtools/install_buildtools.sh - make gen SHORT_PART_PERIOD=1 echo "Running check_license..." diff --git a/scripts/travis/test.sh b/scripts/travis/test.sh index 486316dad2..919ae3588a 100755 --- a/scripts/travis/test.sh +++ b/scripts/travis/test.sh @@ -15,9 +15,6 @@ if [ -z "${SKIP_GO_INSTALLATION}" ]; then eval "$(~/gimme "${GOLANG_VERSION}")" fi -# If this command fails the Makefile will select 'go test' instead. -"${SCRIPTPATH}/../buildtools/install_buildtools.sh" -o "gotest.tools/gotestsum" || true - if [ "${OS}-${ARCH}" = "linux-arm" ] || [ "${OS}-${ARCH}" = "windows-amd64" ]; then # for arm, no tests need to be invoked. # for now, disable tests on windows. diff --git a/test/scripts/e2e_client_runner.py b/test/scripts/e2e_client_runner.py index 3d5888696f..ce16ed4e22 100755 --- a/test/scripts/e2e_client_runner.py +++ b/test/scripts/e2e_client_runner.py @@ -513,9 +513,10 @@ def main(): def finish_test_results(jsonfile, jsonpath, junitpath): # This only runs in CI, since TEST_RESULTS env var controls the # block that opens the jsonfile, and registers this atexit. So we - # assume jsonfile is open, and gotestsum available. + # assume jsonfile is open. jsonfile.close() - xrun(["gotestsum", "--junitfile", junitpath, "--raw-command", "cat", jsonpath]) + xrun(["go", "run", "gotest.tools/gotestsum@v1.10.0", + "--junitfile", junitpath, "--raw-command", "cat", jsonpath]) if __name__ == '__main__': diff --git a/test/scripts/e2e_go_tests.sh b/test/scripts/e2e_go_tests.sh index 1d2810f60a..471534068a 100755 --- a/test/scripts/e2e_go_tests.sh +++ b/test/scripts/e2e_go_tests.sh @@ -7,13 +7,8 @@ set -o pipefail export GOPATH=$(go env GOPATH) -# Needed for now because circleci doesn't use makefile yet -if [ -z "$(which gotestsum)" ]; then - GOTESTCOMMAND=${GOTESTCOMMAND:="go test"} -else - TEST_RESULTS=${TEST_RESULTS:="$(pwd)"} - GOTESTCOMMAND=${GOTESTCOMMAND:="gotestsum --format testname --junitfile ${TEST_RESULTS}/results.xml --jsonfile ${TEST_RESULTS}/testresults.json --"} -fi +TEST_RESULTS=${TEST_RESULTS:="$(pwd)"} +GOTESTCOMMAND=${GOTESTCOMMAND:="go run gotest.tools/gotestsum@v1.10.0 --format testname --junitfile ${TEST_RESULTS}/results.xml --jsonfile ${TEST_RESULTS}/testresults.json --"} echo "GOTESTCOMMAND will be: ${GOTESTCOMMAND}"