From 4325b67394164170aa94f2aa3224e29072a3b018 Mon Sep 17 00:00:00 2001 From: kruskal <99559985+kruskall@users.noreply.github.com> Date: Tue, 19 Nov 2024 00:29:37 +0100 Subject: [PATCH] feat: drop archived gotestcover gotestcover has been archived and is no longer maintained the readme recommends replacing the tool with xargs+tail drop the dependency and update the makefile accordingly --- NOTICE.txt | 16 ---------------- go.mod | 1 - go.sum | 2 -- libbeat/scripts/Makefile | 10 ++-------- tools/tools.go | 1 - 5 files changed, 2 insertions(+), 28 deletions(-) diff --git a/NOTICE.txt b/NOTICE.txt index 5e7a5bd65b9..9fb388da277 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -22255,22 +22255,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -Dependency : github.com/pierrre/gotestcover -Version: v0.0.0-20160517101806-924dca7d15f0 -Licence type (autodetected): MIT --------------------------------------------------------------------------------- - -Contents of probable licence file $GOMODCACHE/github.com/pierrre/gotestcover@v0.0.0-20160517101806-924dca7d15f0/LICENSE: - -Copyright (C) 2015 Pierre Durand - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -------------------------------------------------------------------------------- Dependency : github.com/pkg/errors Version: v0.9.1 diff --git a/go.mod b/go.mod index 0ae36e088b8..7af0e002dc6 100644 --- a/go.mod +++ b/go.mod @@ -112,7 +112,6 @@ require ( github.com/mitchellh/mapstructure v1.5.0 github.com/olekukonko/tablewriter v0.0.5 github.com/osquery/osquery-go v0.0.0-20231108163517-e3cde127e724 - github.com/pierrre/gotestcover v0.0.0-20160517101806-924dca7d15f0 github.com/pkg/errors v0.9.1 github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.1 diff --git a/go.sum b/go.sum index 56c592bb507..937ec918690 100644 --- a/go.sum +++ b/go.sum @@ -782,8 +782,6 @@ github.com/pierrec/lz4 v2.6.0+incompatible h1:Ix9yFKn1nSPBLFl/yZknTp8TU5G4Ps0JDm github.com/pierrec/lz4 v2.6.0+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/lz4/v4 v4.1.18 h1:xaKrnTkyoqfh1YItXl56+6KJNVYWlEEPuAQW9xsplYQ= github.com/pierrec/lz4/v4 v4.1.18/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= -github.com/pierrre/gotestcover v0.0.0-20160517101806-924dca7d15f0 h1:i5VIxp6QB8oWZ8IkK8zrDgeT6ORGIUeiN+61iETwJbI= -github.com/pierrre/gotestcover v0.0.0-20160517101806-924dca7d15f0/go.mod h1:4xpMLz7RBWyB+ElzHu8Llua96TRCB3YwX+l5EP1wmHk= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= diff --git a/libbeat/scripts/Makefile b/libbeat/scripts/Makefile index 4360aa0c192..57f153c0a72 100755 --- a/libbeat/scripts/Makefile +++ b/libbeat/scripts/Makefile @@ -70,8 +70,6 @@ BUILD_DIR?=$(shell pwd)/build PKG_BUILD_DIR?=$(BUILD_DIR)/package${PKG_SUFFIX} PKG_UPLOAD_DIR?=$(BUILD_DIR)/upload COVERAGE_DIR?=${BUILD_DIR}/coverage -COVERAGE_TOOL?=${BEAT_GOPATH}/bin/gotestcover -COVERAGE_TOOL_REPO?=github.com/pierrre/gotestcover TESTIFY_TOOL_REPO?=github.com/stretchr/testify/assert NOW=$(shell date -u '+%Y-%m-%dT%H:%M:%SZ') GOBUILD_FLAGS?=-ldflags "-X github.com/elastic/beats/libbeat/version.buildTime=$(NOW) -X github.com/elastic/beats/libbeat/version.commit=$(COMMIT_ID)" @@ -188,16 +186,13 @@ ci: ## @build Shortcut for continuous integration. This should always run befor .PHONY: prepare-tests prepare-tests: mkdir -p ${COVERAGE_DIR} - # gotestcover is needed to fetch coverage for multiple packages - go ${INSTALL_CMD} ${COVERAGE_TOOL_REPO} # testify is needed for unit and integration tests go ${INSTALL_CMD} ${TESTIFY_TOOL_REPO} .PHONY: unit-tests unit-tests: ## @testing Runs the unit tests with coverage. Race is not enabled for unit tests because tests run much slower. unit-tests: prepare-tests - GOFLAGS="${INSTALL_FLAG}" \ - $(COVERAGE_TOOL) $(RACE) -coverprofile=${COVERAGE_DIR}/unit.cov ${GOPACKAGES} + echo 'mode: atomic' > "${COVERAGE_DIR}/unit.cov" && echo "${GOPACKAGES}" | xargs -I{} sh -c 'GOFLAGS="${INSTALL_FLAG}" go test $(RACE) -covermode=atomic -coverprofile=coverage.tmp {} && tail -n +2 coverage.tmp >> ${COVERAGE_DIR}/unit.cov' && rm coverage.tmp .PHONY: unit unit: ## @testing Runs the unit tests without coverage reports. @@ -207,8 +202,7 @@ unit: ## @testing Runs the unit tests without coverage reports. integration-tests: ## @testing Run integration tests. Unit tests are run as part of the integration tests. integration-tests: prepare-tests mage rm -f docker-compose.yml.lock - GOFLAGS="${INSTALL_FLAG}" \ - $(COVERAGE_TOOL) -tags=integration $(RACE) -coverprofile=${COVERAGE_DIR}/integration.cov ${GOPACKAGES} + echo 'mode: atomic' > "${COVERAGE_DIR}/integration.cov" && echo "${GOPACKAGES}" | xargs -I{} sh -c 'GOFLAGS="${INSTALL_FLAG}" go test $(RACE) -tags=integration -covermode=atomic -coverprofile=coverage.tmp {} && tail -n +2 coverage.tmp >> ${COVERAGE_DIR}/integration.cov' && rm coverage.tmp .PHONY: integration-tests-environment integration-tests-environment: ## @testing Runs the integration inside a virtual environment. This can be run on any docker-machine (local, remote) diff --git a/tools/tools.go b/tools/tools.go index fe36ef49ade..6ac5ec76691 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -24,7 +24,6 @@ package tools import ( _ "github.com/magefile/mage" - _ "github.com/pierrre/gotestcover" _ "github.com/stretchr/testify/assert" _ "github.com/tsg/go-daemon" _ "golang.org/x/tools/cmd/goimports"