From 0c2128a573b66a9e273540d7ed67304cdbb98701 Mon Sep 17 00:00:00 2001 From: Yvonnick Esnault Date: Thu, 19 Nov 2020 09:01:13 +0100 Subject: [PATCH] refactor: move cli to cmd package (#308) --- .build/core.mk | 11 ++ .build/go.mk | 222 ++++++++++++++++++++++++++ .gitignore | 12 +- Makefile | 91 ++++++++--- {cli => cmd}/cli.go | 2 +- {cli => cmd}/venom/.gitignore | 0 cmd/venom/Makefile | 25 +++ {cli => cmd}/venom/main.go | 6 +- {cli => cmd}/venom/run/cmd.go | 0 {cli => cmd}/venom/update/cmd.go | 16 +- {cli => cmd}/venom/version/version.go | 0 go.mod | 9 +- go.sum | 34 ++++ linting.mk | 27 ---- package.sh | 14 -- process_testcase.go | 4 +- process_testcase_test.go | 4 +- process_teststep.go | 6 +- 18 files changed, 399 insertions(+), 84 deletions(-) create mode 100644 .build/core.mk create mode 100644 .build/go.mk rename {cli => cmd}/cli.go (94%) rename {cli => cmd}/venom/.gitignore (100%) create mode 100644 cmd/venom/Makefile rename {cli => cmd}/venom/main.go (79%) rename {cli => cmd}/venom/run/cmd.go (100%) rename {cli => cmd}/venom/update/cmd.go (82%) rename {cli => cmd}/venom/version/version.go (100%) delete mode 100644 linting.mk delete mode 100755 package.sh diff --git a/.build/core.mk b/.build/core.mk new file mode 100644 index 00000000..de14a10f --- /dev/null +++ b/.build/core.mk @@ -0,0 +1,11 @@ +CI := $(if ${CI},${CI},0) +VERSION := $(if ${CDS_SEMVER},${CDS_SEMVER},snapshot) +CDS_VERSION := $(if ${CDS_VERSION},${CDS_VERSION},snapshot) +UNAME := $(shell uname) +UNAME_LOWERCASE := $(shell uname -s| tr A-Z a-z) + +.PHONY: help +help: + @grep -hE '^[ a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \ + awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-17s\033[0m %s\n", $$1, $$2}' + diff --git a/.build/go.mk b/.build/go.mk new file mode 100644 index 00000000..12ad3d10 --- /dev/null +++ b/.build/go.mk @@ -0,0 +1,222 @@ + + +GO_BUILD = CGO_ENABLED=0 go build -installsuffix cgo +GO_LIST = env GO111MODULE=on go list +TEST_CMD = go test -v -timeout 600s -coverprofile=profile.coverprofile +TEST_C_CMD = go test -c -coverprofile=profile.coverprofile +TEST_RUN_ARGS = -test.v -test.timeout 600s -test.coverprofile=profile.coverprofile +CURRENT_PACKAGE = $(shell $(GO_LIST)) +VERSION := $(if ${CDS_SEMVER},${CDS_SEMVER},snapshot) +TARGET_DIST := ./dist +TARGET_RESULTS := ./results + +##### =====> Clean <===== ##### + +mk_go_clean: # clean target directory + @rm -rf $(TARGET_DIST) + @rm -rf $(TARGET_RESULTS) + @for testfile in `find ./ -name "bin.test"`; do \ + rm $$testfile; \ + done; + @for TST in `find ./ -name "tests.log"`; do \ + rm $$TST; \ + done; + @for profile in `find ./ -name "*.coverprofile"`; do \ + rm $$profile; \ + done; + +##### =====> Compile <===== ##### + +IS_TEST := $(filter test,$(MAKECMDGOALS)) +TARGET_OS := $(if ${ENABLE_CROSS_COMPILATION},$(if ${OS},${OS}, $(if $(IS_TEST), $(shell go env GOOS), darwin linux freebsd netbsd openbsd solaris windows)),$(shell go env GOOS)) +TARGET_ARCH := $(if ${ARCH},${ARCH}, $(if $(IS_TEST), $(shell go env GOARCH),amd64)) +BINARIES = $(addprefix $(TARGET_DIST)/, $(addsuffix _$(OS)_$(ARCH)$(if $(IS_WINDOWS),.exe), $(notdir $(TARGET_NAME)))) +CROSS_COMPILED_BINARIES = $(foreach OS, $(TARGET_OS), $(foreach ARCH, $(TARGET_ARCH), $(BINARIES))) +GOFILES = $(call get_recursive_files, '.') + +mk_go_build: + $(info *** mk_go_build) + +$(CROSS_COMPILED_BINARIES): $(GOFILES) $(TARGET_DIST) + $(info *** compiling $@) + @GOOS=$(call get_os_from_binary_file,$@) \ + GOARCH=$(call get_arch_from_binary_file,$@) \ + $(GO_BUILD) $(BUILD_MODE) $(LDFLAGS) -o $@; + +##### =====> Compile Tests <===== ##### + +PKGS = $(or $(PKG),$(shell $(GO_LIST) ./...)) +TESTPKGS = $(shell $(GO_LIST) -f \ + '{{ if or .TestGoFiles .XTestGoFiles }}{{ .ImportPath }}{{ end }}' \ + $(PKGS)) + +TESTPKGS_C_FILE = $(addsuffix /bin.test, $(subst $(CURRENT_PACKAGE),.,$(PKG))) +TESTPKGS_C = $(foreach PKG, $(TESTPKGS), $(TESTPKGS_C_FILE)) + +$(TESTPKGS_C): #main_test.go + $(info *** compiling test $@) + @cd $(dir $@) && $(TEST_C_CMD) -o bin.test . + +##### =====> Running Tests <===== ##### + +TESTPKGS_RESULTS_LOG_FILE = $(addsuffix /tests.log, $(subst $(CURRENT_PACKAGE),.,$(PKG))) +TESTPKGS_RESULTS = $(foreach PKG, $(TESTPKGS), $(TESTPKGS_RESULTS_LOG_FILE)) + +$(HOME)/.richstyle.yml: + echo "leaveTestPrefix: true" > $(HOME)/.richstyle.yml + +GO_RICHGO = ${GOPATH}/bin/richgo +$(GO_RICHGO): $(HOME)/.richstyle.yml + go get -u github.com/kyoh86/richgo + +EXIT_TESTS := 0 +$(TESTPKGS_RESULTS): $(GOFILES) $(TESTPKGS_C) $(GO_RICHGO) + $(info *** executing tests in $(dir $@)) + @-cd $(dir $@) && ./bin.test $(TEST_RUN_ARGS) | tee tests.log | richgo testfilter ; + +GO_COV_MERGE = ${GOPATH}/bin/gocovmerge +$(GO_COV_MERGE): + go get -u github.com/wadey/gocovmerge + +GO_GOJUNIT = ${GOPATH}/bin/go-junit-report +$(GO_GOJUNIT): + go get -u github.com/jstemmer/go-junit-report + +GO_COBERTURA = ${GOPATH}/bin/gocover-cobertura +$(GO_COBERTURA): + go get -u github.com/t-yuki/gocover-cobertura + +mk_go_test: $(GO_COV_MERGE) $(GO_COBERTURA) $(GOFILES) $(TARGET_RESULTS) $(TESTPKGS_RESULTS)# Run tests + @echo "Generating unit tests coverage..." + @$(GO_COV_MERGE) `find ./ -name "*.coverprofile"` > $(TARGET_RESULTS)/cover.out + @$(GO_COBERTURA) < $(TARGET_RESULTS)/cover.out > $(TARGET_RESULTS)/coverage.xml + @go tool cover -html=$(TARGET_RESULTS)/cover.out -o=$(TARGET_RESULTS)/cover.html + @NB=$$(grep "^FAIL" `find . -type f -name "tests.log"`|grep -v ':0'|wc -l); echo "tests failed $$NB" && exit $$NB + +mk_go_test-xunit: $(GO_GOJUNIT) $(TARGET_RESULTS) # Generate test with xunit report + @echo "Generating xUnit Report..." + @for TST in `find . -name "tests.log"`; do \ + if [ -s $$TST ]; then \ + FAILED=`grep -E '(FAIL)+\s([a-z\.\/]*)\s\[build failed\]' $$TST | wc -l`; \ + if [ $$FAILED -gt 0 ]; then \ + echo "Build Failed \t\t\t($$TST)"; \ + echo "Build Failed \t\t\t($$TST)" >> $(TARGET_RESULTS)/fail; \ + else \ + NO_TESTS=`grep -E '\?+\s+([a-z\.\/]*)\s\[no test files\]' $$TST | wc -l`; \ + if [ $$NO_TESTS -gt 0 ]; then \ + echo "No tests found \t\t\t($$TST)"; \ + else \ + if [ ! -z "${CDS_VERSION}" ]; then \ + echo "Sending $$TST to CDS"; \ + worker upload --tag `echo $$TST | sed 's|./||' | sed 's|./||' | sed 's|/|_|g') | sed 's|_tests.log||'` $(abspath $$TST); \ + fi; \ + echo "Generating xUnit report \t$$TST.tests-results.xml"; \ + cat $$TST | $(GO_GOJUNIT) > $$TST.tests-results.xml; \ + fi; \ + fi; \ + else \ + echo "Ignoring empty file \t\t$$TST"; \ + fi; \ + done; \ + for XML in `find . -name "tests.log.tests-results.xml"`; do \ + if [ "$$XML" = "./tests.log.tests-results.xml" ]; then \ + PWD=`pwd`; \ + mv $$XML $(TARGET_RESULTS)/`basename $(PWD)`.tests-results.xml; \ + else \ + mv $$XML $(TARGET_RESULTS)/`echo $$XML | sed 's|./||' | sed 's|/|_|g' | sed 's|_tests.log||'`; \ + fi; \ + done; \ + rm -f $(TARGET_RESULTS)/report; \ + for XML in `find . -name "*.tests-results.xml"`; do \ + if [ -s $$XML ]; then \ + if grep -q 'testsuite' $$XML; then \ + echo "Generating report: " $$XML; \ + echo "`xmllint --xpath "//testsuite/@name" $$XML | sed 's/name=//' | sed 's/"//g'`" \ + "`xmllint --xpath "//testsuite/@tests" $$XML | sed 's/tests=//' | sed 's/"//g'` Tests :" \ + "`xmllint --xpath "//testsuite/@errors" $$XML 2>/dev/null | sed 's/errors=//' | sed 's/"//g'` Errors ;"\ + "`xmllint --xpath "//testsuite/@failures" $$XML 2>/dev/null | sed 's/failures=//' | sed 's/"//g'` Failures;" \ + "`xmllint --xpath "//testsuite/@skip" $$XML 2>/dev/null | sed 's/skip=//' | sed 's/"//g'` Skipped;" \ + >> $(TARGET_RESULTS)/report; \ + fi; \ + fi; \ + done; \ + if [ -e $(TARGET_RESULTS)/report ]; then \ + cat $(TARGET_RESULTS)/report; \ + fi; \ + echo "#########################"; \ + for XML in `find . -name "*.tests-results.xml"`; do \ + if [ -s $$XML ]; then \ + if grep -q 'errors' $$XML && grep -q 'testsuite' $$XML; then \ + if [ "`xmllint --xpath "//testsuite/@errors" $$XML | sed 's/errors=//' | sed 's/"//g'`" -gt "0" ]; then \ + echo " $$XML : Tests failed"; \ + fi; \ + fi; \ + if grep -q 'failures' $$XML && grep -q 'testsuite' $$XML $$XML; then \ + if [ "`xmllint --xpath "//testsuite/@failures" $$XML | sed 's/failures=//' | sed 's/"//g'`" -gt "0" ]; then \ + echo " $$XML : Tests failed"; \ + fi; \ + fi; \ + fi; \ + done; \ + if [ -e $(TARGET_RESULTS)/fail ]; then \ + echo "#########################"; \ + echo "ERROR: Test compilation failure"; \ + cat $(TARGET_RESULTS)/fail; \ + exit 1; \ + fi; + +##### =====> lint <===== ##### + +TMP_DIR = /tmp/ovh/venom + +OSNAME=$(shell go env GOOS) +CUR_PATH = $(notdir $(shell pwd)) + +GOLANGCI_DIR = $(TMP_DIR)/$(CUR_PATH)/golangci-lint +GOLANGCI_TMP_BIN = $(GOLANGCI_DIR)/golangci-lint + +GOLANGCI_LINT_VERSION=1.31.0 +GOLANGCI_CMD = $(GOLANGCI_TMP_BIN) run --allow-parallel-runners -c .golangci.yml +GOLANGCI_LINT_ARCHIVE = golangci-lint-$(GOLANGCI_LINT_VERSION)-$(OSNAME)-amd64.tar.gz + +# Run this on localc machine. +# It downloads a version of golangci-lint and execute it locally. +# duration first time ~6s +# duration second time ~2s +.PHONY: lint +lint: $(GOLANGCI_TMP_BIN) + $(GOLANGCI_DIR)/$(GOLANGCI_CMD) + +# install a local golangci-lint if not found. +$(GOLANGCI_TMP_BIN): + curl -OL https://github.com/golangci/golangci-lint/releases/download/v$(GOLANGCI_LINT_VERSION)/$(GOLANGCI_LINT_ARCHIVE) + mkdir -p $(GOLANGCI_DIR)/ + tar -xf $(GOLANGCI_LINT_ARCHIVE) --strip-components=1 -C $(GOLANGCI_DIR)/ + chmod +x $(GOLANGCI_TMP_BIN) + rm -f $(GOLANGCI_LINT_ARCHIVE) + +mk_go_lint: $(GOLANG_CI_LINT) # run golangci lint + $(info *** running lint) + $(GOLANGCI_CMD) + +##### =====> Internals <===== ##### + +$(TARGET_RESULTS): + $(info create $(TARGET_RESULTS) directory) + @mkdir -p $(TARGET_RESULTS) + +$(TARGET_DIST): + $(info create $(TARGET_DIST) directory) + @mkdir -p $(TARGET_DIST) + +define get_os_from_binary_file +$(strip $(shell echo $(1) | cut -d'_' -f 2)) +endef + +define get_arch_from_binary_file +$(strip $(patsubst %.exe, %,$(shell echo $(1) | cut -d'_' -f 3))) +endef + +define get_recursive_files +$(subst ./,,$(shell find $(1) -type f -name "*.go" -print)) +endef \ No newline at end of file diff --git a/.gitignore b/.gitignore index c6eb5821..66940917 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,16 @@ .idea .vscode -cli/venom/bin -venom +cmd/venom/bin tests/pprof* tests/.DS_Store .DS_Store vendor/ dist/ -venom.log \ No newline at end of file +venom.log +*.so +foo.yml +dist +results +bin.test +profile.coverprofile +tests.log \ No newline at end of file diff --git a/Makefile b/Makefile index 327f5eb8..2381f026 100644 --- a/Makefile +++ b/Makefile @@ -1,27 +1,78 @@ -include linting.mk +##### ^^^^^^ USAGE ^^^^^^ ##### -.PHONY: all -all: deps lint build test +##### ^^^^^^ make help ^^^^^^ ##### -.PHONY: tidy -tidy: - go mod tidy +DOCKER_IMAGE := $(if ${DOCKER_IMAGE},${DOCKER_IMAGE},ovhcom/venom:snapshot) +DOCKER_IMAGE_NAME = $(shell echo $(DOCKER_IMAGE) | cut -d ':' -f 1) +DOCKER_IMAGE_TAG = $(shell echo $(DOCKER_IMAGE) | cut -d ':' -f 2) -.PHONY: download -download: - go mod download +##### ^^^^^^ EDIT ABOVE ^^^^^^ ##### -.PHONY: deps -deps: tidy download +include ./.build/core.mk -.PHONY: verify -verify: - go mod verify +ifneq (,$(strip $(filter build dist run lint clean test test-xunit,$(MAKECMDGOALS)))) +include ./.build/go.mk +endif -.PHONY: build -build: - go build ./... +DIST_DIR := dist/ +RESULTS_DIR := results/ -.PHONY: test -test: - go test ./... +APP_DIST := $(wildcard cmd/venom/dist/*) +ALL_DIST := $(APP_DIST) +ALL_DIST_TARGETS := $(foreach DIST,$(ALL_DIST),$(addprefix $(DIST_DIR),$(notdir $(DIST)))) + +APP_RESULTS = $(wildcard cmd/venom/results/*) +ALL_RESULTS = $(APP_RESULTS) +ALL_RESULTS_TARGETS := $(foreach RESULTS,$(ALL_RESULTS),$(addprefix $(RESULTS_DIR),$(notdir $(RESULTS)))) + + +define get_dist_from_target +$(filter %/$(notdir $(1)), $(ALL_DIST)) +endef + +define get_results_from_target +$(filter %/$(notdir $(1)), $(ALL_RESULTS)) +endef + +$(ALL_DIST_TARGETS): + @mkdir -p $(DIST_DIR) + $(info copying $(call get_dist_from_target, $@) to $@) + @cp -f $(call get_dist_from_target, $@) $@ + +$(ALL_RESULTS_TARGETS): + @mkdir -p $(RESULTS_DIR) + $(info copying $(call get_results_from_target, $@) to $@) + @cp -f $(call get_results_from_target, $@) $@ + +.PHONY: build lint clean testrun test dist test-xunit package + +build: ## build all components and push them into dist directory + $(info Building Component venom) + $(MAKE) build -C cmd/venom + $(MAKE) dist + +dist: $(ALL_DIST_TARGETS) + +run: ## build binary for current OS only and run it. For development purpose only + OS=${UNAME_LOWERCASE} $(MAKE) build -C cmd/venom + @cmd/venom/dist/venom_${UNAME_LOWERCASE}_amd64 + +lint: mk_go_lint ## install and run golangci-lint on all go files. doc https://github.com/golangci/golangci-lint + +clean: mk_go_clean ## delete directories dist and results and all temp files (coverage, tests, reports) + @rm -rf ${DIST_DIR} + @rm -rf ${RESULTS_DIR} + $(MAKE) clean -C cmd/venom + +test-results: $(ALL_RESULTS_TARGETS) + +test: mk_go_test ## run unit tests on all go packages + +integration-test: ## run venom integration tests declared in tests/ directory + $(MAKE) start-test-stack -C tests + +test-xunit: mk_go_test-xunit ## generate xunit report using the results of previous 'make test', useful on CDS only + $(MAKE) test-results + +package: ## build the docker image with existing binaries from dist directory + docker build --tag $(DOCKER_IMAGE) . diff --git a/cli/cli.go b/cmd/cli.go similarity index 94% rename from cli/cli.go rename to cmd/cli.go index f9bb80a9..67a42878 100644 --- a/cli/cli.go +++ b/cmd/cli.go @@ -1,4 +1,4 @@ -package cli +package cmd import ( "fmt" diff --git a/cli/venom/.gitignore b/cmd/venom/.gitignore similarity index 100% rename from cli/venom/.gitignore rename to cmd/venom/.gitignore diff --git a/cmd/venom/Makefile b/cmd/venom/Makefile new file mode 100644 index 00000000..0937025a --- /dev/null +++ b/cmd/venom/Makefile @@ -0,0 +1,25 @@ + +##### ^^^^^^ USAGE ^^^^^^ ##### + +##### ^^^^^^ make help ^^^^^^ ##### + +TARGET_NAME = venom +LDFLAGS = -ldflags "-X github.com/ovh/venom.Version=$(VERSION)" + +# If you want to enable the cross-compilation, uncomment the following line: +ENABLE_CROSS_COMPILATION := true + +##### ^^^^^^ EDIT ABOVE ^^^^^^ ##### + +##### =====> Commands <===== ##### + +include ../../.build/core.mk +include ../../.build/go.mk + +.PHONY: clean + +build: $(CROSS_COMPILED_BINARIES) ## Run build + +clean: + @rm -f venom + @rm -rf dist \ No newline at end of file diff --git a/cli/venom/main.go b/cmd/venom/main.go similarity index 79% rename from cli/venom/main.go rename to cmd/venom/main.go index e3696f81..5e1ca0c3 100644 --- a/cli/venom/main.go +++ b/cmd/venom/main.go @@ -4,9 +4,9 @@ import ( log "github.com/sirupsen/logrus" "github.com/spf13/cobra" - "github.com/ovh/venom/cli/venom/run" - "github.com/ovh/venom/cli/venom/update" - "github.com/ovh/venom/cli/venom/version" + "github.com/ovh/venom/cmd/venom/run" + "github.com/ovh/venom/cmd/venom/update" + "github.com/ovh/venom/cmd/venom/version" ) var rootCmd = &cobra.Command{ diff --git a/cli/venom/run/cmd.go b/cmd/venom/run/cmd.go similarity index 100% rename from cli/venom/run/cmd.go rename to cmd/venom/run/cmd.go diff --git a/cli/venom/update/cmd.go b/cmd/venom/update/cmd.go similarity index 82% rename from cli/venom/update/cmd.go rename to cmd/venom/update/cmd.go index fef4cd59..19977e8a 100644 --- a/cli/venom/update/cmd.go +++ b/cmd/venom/update/cmd.go @@ -10,7 +10,7 @@ import ( "github.com/google/go-github/github" "github.com/inconshreveable/go-update" "github.com/ovh/venom" - "github.com/ovh/venom/cli" + "github.com/ovh/venom/cmd" "github.com/spf13/cobra" ) @@ -30,11 +30,11 @@ func getURLArtifactFromGithub() string { client := github.NewClient(nil) release, resp, err := client.Repositories.GetLatestRelease(context.TODO(), "ovh", "venom") if err != nil { - cli.Exit("Repositories.GetLatestRelease returned error: %v\n%v", err, resp.Body) + cmd.Exit("Repositories.GetLatestRelease returned error: %v\n%v", err, resp.Body) } if *release.TagName == venom.Version { - cli.Exit(fmt.Sprintf("you already have the latest release: %s", *release.TagName)) + cmd.Exit(fmt.Sprintf("you already have the latest release: %s", *release.TagName)) } if len(release.Assets) > 0 { @@ -49,7 +49,7 @@ func getURLArtifactFromGithub() string { text := "Invalid Artifacts on latest release. Please try again in few minutes.\n" text += "If the problem persists, please open an issue on https://github.com/ovh/venom/issues\n" - cli.Exit(text) + cmd.Exit(text) return "" } @@ -68,22 +68,22 @@ func doUpdate() { resp, err := http.Get(url) if err != nil { - cli.Exit("Error when downloading venom from url %s: %v\n", url, err) + cmd.Exit("Error when downloading venom from url %s: %v\n", url, err) } if contentType := getContentType(resp); contentType != "application/octet-stream" { fmt.Printf("Url: %s\n", url) - cli.Exit("Invalid Binary (Content-Type: %s). Please try again or download it manually from %s\n", contentType, urlGitubReleases) + cmd.Exit("Invalid Binary (Content-Type: %s). Please try again or download it manually from %s\n", contentType, urlGitubReleases) } if resp.StatusCode != 200 { - cli.Exit("Error http code: %d, url called: %s\n", resp.StatusCode, url) + cmd.Exit("Error http code: %d, url called: %s\n", resp.StatusCode, url) } fmt.Printf("Getting latest release from: %s ...\n", url) defer resp.Body.Close() if err = update.Apply(resp.Body, update.Options{}); err != nil { - cli.Exit("Error when updating venom from url: %s err:%s\n", url, err.Error()) + cmd.Exit("Error when updating venom from url: %s err:%s\n", url, err.Error()) } fmt.Println("Update done.") } diff --git a/cli/venom/version/version.go b/cmd/venom/version/version.go similarity index 100% rename from cli/venom/version/version.go rename to cmd/venom/version/version.go diff --git a/go.mod b/go.mod index 196047ff..1628ce97 100644 --- a/go.mod +++ b/go.mod @@ -18,12 +18,15 @@ require ( github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf github.com/jhump/protoreflect v1.7.0 github.com/jmoiron/sqlx v1.2.0 + github.com/kyoh86/richgo v0.3.3 // indirect + github.com/kyoh86/xdg v1.2.0 // indirect github.com/lib/pq v1.8.0 github.com/mattn/go-shellwords v1.0.10 github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect github.com/mattn/go-zglob v0.0.3 github.com/mitchellh/mapstructure v1.3.3 github.com/mndrix/tap-go v0.0.0-20171203230836-629fa407e90b + github.com/morikuni/aec v1.0.0 // indirect github.com/mxk/go-imap v0.0.0-20150429134902-531c36c3f12d // indirect github.com/onsi/ginkgo v1.14.2 // indirect github.com/onsi/gomega v1.10.3 // indirect @@ -39,9 +42,13 @@ require ( github.com/spf13/cobra v1.1.1 github.com/streadway/amqp v1.0.0 github.com/stretchr/testify v1.6.1 + github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect + github.com/wacul/ptr v1.0.0 // indirect + github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad // indirect github.com/yesnault/go-imap v0.0.0-20160710142244-eb9bbb66bd7b golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9 - golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 // indirect + golang.org/x/sys v0.0.0-20201118182958-a01c418693c7 // indirect + golang.org/x/tools v0.0.0-20201118215654-4d9c4f8a78b0 // indirect google.golang.org/grpc v1.30.0 gopkg.in/yaml.v2 v2.3.0 ) diff --git a/go.sum b/go.sum index dcc5c665..4423a16d 100644 --- a/go.sum +++ b/go.sum @@ -129,6 +129,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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/deadcheat/goblet v1.3.1/go.mod h1:IrMNyAwyrVgB30HsND2WgleTUM4wHTS9m40yNY6NJQg= +github.com/deadcheat/gonch v0.0.0-20180528124129-c2ff7a019863/go.mod h1:/5mH3gAuXUxGN3maOBAxBfB8RXvP9tBIX5fx2x1k0V0= github.com/denisenkom/go-mssqldb v0.0.0-20191001013358-cfbb681360f0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= github.com/denisenkom/go-mssqldb v0.0.0-20191128021309-1d7a30a10f73 h1:OGNva6WhsKst5OZf7eZOklDztV3hwtTHovdrLHV+MsA= github.com/denisenkom/go-mssqldb v0.0.0-20191128021309-1d7a30a10f73/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= @@ -417,6 +419,12 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kyoh86/richgo v0.3.3 h1:fW7ygWNMg1INcX3Yoha9v1C5nYlvd/IodJUf0Batz6Q= +github.com/kyoh86/richgo v0.3.3/go.mod h1:S65jllVRxBm59fqIXfCa3cPxQYRT9u9v45EPQVeuoH0= +github.com/kyoh86/xdg v0.0.0-20171007020617-d28e4c5d7b81 h1:C2Yb5TxdHWrtWXdf+j8xWW4QQu8lXuxtj1UOK816dpA= +github.com/kyoh86/xdg v0.0.0-20171007020617-d28e4c5d7b81/go.mod h1:Z5mDqe0fxyxn3W2yTxsBAOQqIrXADQIh02wrTnaRM38= +github.com/kyoh86/xdg v1.2.0 h1:CERuT/ShdTDj+A2UaX3hQ3mOV369+Sj+wyn2nIRIIkI= +github.com/kyoh86/xdg v1.2.0/go.mod h1:/mg8zwu1+qe76oTFUBnyS7rJzk7LLC0VGEzJyJ19DHs= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= @@ -440,6 +448,7 @@ github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= +github.com/mattn/go-isatty v0.0.0-20170925054904-a5cdd64afdee/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= @@ -484,6 +493,10 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c h1:nXxl5PrvVm2L/wCy8dQu6DMTwH4oIuGN8GJDAlqDdVE= +github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-imap v0.0.0-20150429134902-531c36c3f12d h1:+DgqA2tuWi/8VU+gVgBAa7+WZrnFbPKhQWbKBB54cVs= github.com/mxk/go-imap v0.0.0-20150429134902-531c36c3f12d/go.mod h1:xacC5qXZnL/ooiitVoe3BtI1OotFTqi5zICBs9J5Fyk= @@ -653,6 +666,7 @@ github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5J github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.1.4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -662,6 +676,8 @@ github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c h1:+aPplBwWcHBo6q9xrfWdMrT9o4kltkmmvpemgIjep/8= +github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c/go.mod h1:SbErYREK7xXdsRiigaQiQkI9McGRzYMvlKYaP3Nimdk= github.com/tj/assert v0.0.0-20171129193455-018094318fb0/go.mod h1:mZ9/Rh9oLWpLLDRpvE+3b7gP/C2YyLFYxNmcLnPTMe0= github.com/tj/go-elastic v0.0.0-20171221160941-36157cbbebc2/go.mod h1:WjeM0Oo1eNAjXGDx2yma7uG2XoyRZTq1uv3M/o7imD0= github.com/tj/go-kinesis v0.0.0-20171128231115-08b17f58cb1b/go.mod h1:/yhzCV0xPfx6jb1bBgRFjl5lytqVqZXEaeqWP8lTEao= @@ -674,6 +690,12 @@ github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4A github.com/ulikunitz/xz v0.5.7/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/wacul/ptr v0.0.0-20170209030335-91632201dfc8 h1:js9Z9dWq50Ttu4D1YRqgS1gkSgRfpKp+rMza4io7qNw= +github.com/wacul/ptr v0.0.0-20170209030335-91632201dfc8/go.mod h1:BD0gjsZrCwtoR+yWDB9v2hQ8STlq9tT84qKfa+3txOc= +github.com/wacul/ptr v1.0.0 h1:FIKu08Wx0YUIf9MNsfF62OCmBSmz5A1Tk65zWhOIL/I= +github.com/wacul/ptr v1.0.0/go.mod h1:BD0gjsZrCwtoR+yWDB9v2hQ8STlq9tT84qKfa+3txOc= +github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad h1:W0LEBv82YCGEtcmPA3uNZBI33/qF//HAAs3MawDjRa0= +github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad/go.mod h1:Hy8o65+MXnS6EwGElrSRjUzQDLXreJlzYLlWiHtt8hM= github.com/xanzy/go-gitlab v0.31.0/go.mod h1:sPLojNBn68fMUWSxIJtdVVIP8uSBYqesTfDUseX11Ug= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= @@ -684,6 +706,7 @@ github.com/yesnault/go-imap v0.0.0-20160710142244-eb9bbb66bd7b h1:mvFk4C4VehqptP github.com/yesnault/go-imap v0.0.0-20160710142244-eb9bbb66bd7b/go.mod h1:LH8s5iF2nb4JFQ1A9fAcvsdqzUGZttifagNxO5TOiPQ= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= github.com/ziutek/mymysql v1.5.4 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs= github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0= @@ -758,7 +781,9 @@ golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180404174746-b3c676e531a6/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -793,6 +818,8 @@ golang.org/x/net v0.0.0-20200904194848-62affa334b73 h1:MXfv8rhZWmFeqX3GNZRsd6vOL golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0 h1:wBouT66WTYFXdxfVdz9sVWARVd/2vfGcmI45D2gj45M= golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -808,6 +835,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a h1:WXEvlFVvvGxCJLG6REjsT03iWnKLEWinaScsxF2Vm2o= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20170927054621-314a259e304f/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -855,6 +884,8 @@ golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201118182958-a01c418693c7 h1:Z991aAXPjz0tLnj74pVXW3eWJ5lHMIBvbRfMq4M2jHA= +golang.org/x/sys v0.0.0-20201118182958-a01c418693c7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -907,7 +938,10 @@ golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375 h1:SjQ2+AKWgZLc1xej6WSzL+Dfs5Uyd5xcZH1mGC411IA= golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20201118215654-4d9c4f8a78b0 h1:ZE8TbQqVy3d5tnnRBBhbtisccQkE4JMRX0YdHumcbNc= +golang.org/x/tools v0.0.0-20201118215654-4d9c4f8a78b0/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/linting.mk b/linting.mk deleted file mode 100644 index 896cb288..00000000 --- a/linting.mk +++ /dev/null @@ -1,27 +0,0 @@ -TMP_DIR = /tmp/ovh/venom - -OSNAME=$(shell go env GOOS) -CUR_PATH = $(notdir $(shell pwd)) - -GOLANGCI_DIR = $(TMP_DIR)/$(CUR_PATH)/golangci-lint -GOLANGCI_TMP_BIN = $(GOLANGCI_DIR)/golangci-lint - -GOLANGCI_LINT_VERSION=1.31.0 -GOLANGCI_CMD = golangci-lint run --allow-parallel-runners -c .golangci.yml -GOLANGCI_LINT_ARCHIVE = golangci-lint-$(GOLANGCI_LINT_VERSION)-$(OSNAME)-amd64.tar.gz - -# Run this on localc machine. -# It downloads a version of golangci-lint and execute it locally. -# duration first time ~6s -# duration second time ~2s -.PHONY: lint -lint: $(GOLANGCI_TMP_BIN) - $(GOLANGCI_DIR)/$(GOLANGCI_CMD) - -# install a local golangci-lint if not found. -$(GOLANGCI_TMP_BIN): - curl -OL https://github.com/golangci/golangci-lint/releases/download/v$(GOLANGCI_LINT_VERSION)/$(GOLANGCI_LINT_ARCHIVE) - mkdir -p $(GOLANGCI_DIR)/ - tar -xf $(GOLANGCI_LINT_ARCHIVE) --strip-components=1 -C $(GOLANGCI_DIR)/ - chmod +x $(GOLANGCI_TMP_BIN) - rm -f $(GOLANGCI_LINT_ARCHIVE) diff --git a/package.sh b/package.sh deleted file mode 100755 index 7c3f6ac6..00000000 --- a/package.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -cd cli/venom -for DIST in `go tool dist list | grep -v '^android/' | grep -v '^dragonfly/' | grep -v '^illumos/' | grep -v 'mips' | grep -v 'riscv64' | grep -v 'ppc64' | grep -v 's390x' | grep -v '^nacl/' | grep -v '^plan9/' | grep -v '^darwin/arm' | grep -v '^js/wasm' | grep -v 'bsd/arm64' | grep -v 'windows/arm' `; do - GOOS=`echo ${DIST} | cut -d / -f 1` - GOARCH=`echo ${DIST} | cut -d / -f 2` - - architecture="${GOOS}-${GOARCH}" - echo "Building ${architecture} ${path}" - export GOOS=$GOOS - export GOARCH=$GOARCH - - CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags "-X github.com/ovh/venom.Version=${GIT_DESCRIBE}" -o bin/venom.${architecture} -done diff --git a/process_testcase.go b/process_testcase.go index 2a780514..319e0907 100644 --- a/process_testcase.go +++ b/process_testcase.go @@ -219,7 +219,7 @@ func (v *Venom) runTestCase(ctx context.Context, ts *TestSuite, tc *TestCase) { allVars := tc.Vars.Clone() allVars.AddAll(tc.computedVars.Clone()) - assign, _, err := ProcessVariableAssigments(ctx, tc.Name, allVars, rawStep) + assign, _, err := processVariableAssigments(ctx, tc.Name, allVars, rawStep) if err != nil { tc.AppendError(err) Error(ctx, "unable to process variable assignments: %v", err) @@ -230,7 +230,7 @@ func (v *Venom) runTestCase(ctx context.Context, ts *TestSuite, tc *TestCase) { } } -func ProcessVariableAssigments(ctx context.Context, tcName string, tcVars H, rawStep json.RawMessage) (H, bool, error) { +func processVariableAssigments(ctx context.Context, tcName string, tcVars H, rawStep json.RawMessage) (H, bool, error) { var stepAssignment AssignStep var result = make(H) if err := yaml.Unmarshal(rawStep, &stepAssignment); err != nil { diff --git a/process_testcase_test.go b/process_testcase_test.go index 19409519..68742000 100644 --- a/process_testcase_test.go +++ b/process_testcase_test.go @@ -26,7 +26,7 @@ func TestProcessVariableAssigments(t *testing.T) { tcVars := H{"here.some.value": "this is the \nvalue"} - result, is, err := ProcessVariableAssigments(context.TODO(), "", tcVars, b) + result, is, err := processVariableAssigments(context.TODO(), "", tcVars, b) assert.True(t, is) assert.NoError(t, err) assert.NotNil(t, result) @@ -38,7 +38,7 @@ func TestProcessVariableAssigments(t *testing.T) { script: echo 'foo' `) assert.NoError(t, yaml.Unmarshal(b, &wrongStepIn)) - result, is, err = ProcessVariableAssigments(context.TODO(), "", tcVars, b) + result, is, err = processVariableAssigments(context.TODO(), "", tcVars, b) assert.False(t, is) assert.NoError(t, err) assert.Nil(t, result) diff --git a/process_teststep.go b/process_teststep.go index aeb1541d..d66f2f67 100644 --- a/process_teststep.go +++ b/process_teststep.go @@ -14,7 +14,7 @@ import ( "github.com/ovh/venom/executors" ) -type DumpFile struct { +type dumpFile struct { Variables interface{} `json:"variables"` TestStep TestStep `json:"step"` Result interface{} `json:"result"` @@ -51,12 +51,12 @@ func (v *Venom) RunTestStep(ctx context.Context, e ExecutorRunner, ts *TestSuite mapResultString, _ := executors.DumpString(result) if v.Verbose == 2 { - dumpFile := DumpFile{ + fdump := dumpFile{ Result: result, TestStep: step, Variables: ts.Vars, } - output, _ := json.MarshalIndent(dumpFile, "", " ") + output, _ := json.MarshalIndent(fdump, "", " ") oDir := v.OutputDir if oDir == "" {