From 37acaea22f8d4d969a2ec6d77615cefb6add64bf Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Thu, 25 Mar 2021 12:58:53 +0800 Subject: [PATCH 1/2] Moves lint and format to make, managed by bingo This removes a few shell scripts and in the process updates linters to more current versions. For example, we were using golangci from 2019. To adjust, some invalid statements were removed. The main part of this change is using https://github.com/bwplotka/bingo as the linters we used were go programs anyway. Bingo generates make entries you can use to on-demang install tools without affecting your go.mod and without shell scripts. Co-authored-by: Takeshi Yoneda Signed-off-by: Adrian Cole --- .bingo/.gitignore | 12 ++++ .bingo/README.md | 14 +++++ .bingo/Variables.mk | 43 ++++++++++++++ .bingo/go.mod | 1 + .bingo/goimports.mod | 5 ++ .bingo/golangci-lint.mod | 5 ++ .bingo/licenser.mod | 5 ++ .bingo/shfmt.mod | 5 ++ .bingo/variables.env | 18 ++++++ .circleci/config.yml | 15 +++-- .licenserignore | 4 ++ CONTRIBUTING.md | 4 +- Makefile | 58 +++++++++++++++++++ ci/format | 8 --- ci/install-envoy | 4 -- ci/install-lint | 16 ----- ci/lint | 28 --------- ci/test | 5 -- .../envoy.access_loggers/default/main_test.go | 1 - .../envoy.filters.http/default/main_test.go | 1 - pkg/binary/envoy/controlplane/istio.go | 7 +-- pkg/binary/envoy/controlplane/istio_test.go | 5 +- pkg/binary/envoy/debug/admin.go | 1 - pkg/binary/envoy/debug/log.go | 3 +- pkg/binary/envoy/debug/log_linux.go | 3 +- pkg/binary/envoy/debug/lsof.go | 2 +- pkg/binary/envoy/debug/node.go | 3 +- pkg/binary/envoy/fetch.go | 15 ++--- pkg/binary/envoy/fetch_test.go | 4 +- pkg/binary/envoy/run.go | 3 +- pkg/binary/envoy/run_test.go | 1 + pkg/binary/envoy/runtime.go | 1 - pkg/binary/envoy/start.go | 3 +- pkg/binary/envoy/termination.go | 3 +- pkg/binary/envoytest/util.go | 1 + pkg/cmd/extension/build/cmd.go | 1 - pkg/cmd/extension/build/cmd_test.go | 2 - pkg/cmd/extension/clean/cmd.go | 1 - pkg/cmd/extension/clean/cmd_test.go | 2 - pkg/cmd/extension/common/toolchain.go | 3 +- pkg/cmd/extension/example/cmd_add_test.go | 2 - pkg/cmd/extension/example/cmd_list_test.go | 2 - pkg/cmd/extension/example/cmd_remove_test.go | 2 - pkg/cmd/extension/init/cmd_test.go | 1 - pkg/cmd/extension/init/feedback.go | 1 + pkg/cmd/extension/init/feedback_test.go | 1 - pkg/cmd/extension/init/params.go | 1 - pkg/cmd/extension/init/wizard_test.go | 1 - pkg/cmd/extension/root_test.go | 1 - pkg/cmd/extension/test/cmd.go | 1 - pkg/cmd/extension/test/cmd_test.go | 2 - pkg/cmd/fetch.go | 1 + pkg/cmd/list.go | 1 + pkg/cmd/root.go | 7 +-- pkg/cmd/root_test.go | 5 +- pkg/cmd/run.go | 5 +- pkg/common/home.go | 3 +- .../example/init/registry/default.go | 1 - .../example/init/registry/interfaces.go | 3 +- pkg/extension/init/descriptor_test.go | 1 - pkg/extension/init/init.go | 1 - .../config/extension/extension_test.go | 3 +- .../config/toolchain/builtin/helpers.go | 2 +- .../config/toolchain/builtin/helpers_test.go | 1 - .../workspace/example/envoy/template/data.go | 6 +- .../example/envoy/template/defaults.go | 8 +-- .../example/envoy/template/expand_test.go | 3 +- .../workspace/example/envoy/util/load.go | 7 +-- .../workspace/example/envoy/util/load_test.go | 6 +- .../example/runtime/configdir/configdir.go | 2 +- .../example/runtime/getenvoy/runtime.go | 1 - .../example/runtime/getenvoy/runtime_test.go | 4 +- .../runtime/getenvoy/testdata/.licenserignore | 2 + pkg/extension/workspace/example/scaffold.go | 1 - pkg/extension/workspace/model/interfaces.go | 1 - pkg/extension/workspace/model/workspace.go | 1 + .../toolchain/builtin/example_config.go | 1 + .../toolchain/builtin/factory_test.go | 3 +- .../builtin/testdata/.licenserignore | 2 + .../workspace/toolchain/builtin/toolchain.go | 1 - .../toolchain/builtin/toolchain_test.go | 3 +- pkg/flavors/postgres/postgres.go | 3 +- pkg/manifest/locate.go | 2 +- pkg/manifest/print.go | 1 + pkg/manifest/print_test.go | 1 + pkg/pii/pii.go | 1 - pkg/test/manifest/server.go | 6 +- pkg/util/args/args.go | 3 +- pkg/util/cmd/cmd_test.go | 9 +-- pkg/util/cmd/errors/handlers.go | 1 + pkg/util/cmd/run_test.go | 3 +- test/e2e/getenvoy_extension_run_test.go | 4 +- 92 files changed, 255 insertions(+), 196 deletions(-) create mode 100755 .bingo/.gitignore create mode 100755 .bingo/README.md create mode 100644 .bingo/Variables.mk create mode 100755 .bingo/go.mod create mode 100644 .bingo/goimports.mod create mode 100644 .bingo/golangci-lint.mod create mode 100644 .bingo/licenser.mod create mode 100644 .bingo/shfmt.mod create mode 100644 .bingo/variables.env delete mode 100755 ci/format delete mode 100755 ci/install-envoy delete mode 100755 ci/install-lint delete mode 100755 ci/lint delete mode 100755 ci/test create mode 100644 pkg/extension/workspace/example/runtime/getenvoy/testdata/.licenserignore diff --git a/.bingo/.gitignore b/.bingo/.gitignore new file mode 100755 index 00000000..4f2055b6 --- /dev/null +++ b/.bingo/.gitignore @@ -0,0 +1,12 @@ + +# Ignore everything +* + +# But not these files: +!.gitignore +!*.mod +!README.md +!Variables.mk +!variables.env + +*tmp.mod diff --git a/.bingo/README.md b/.bingo/README.md new file mode 100755 index 00000000..7a5c2d4f --- /dev/null +++ b/.bingo/README.md @@ -0,0 +1,14 @@ +# Project Development Dependencies. + +This is directory which stores Go modules with pinned buildable package that is used within this repository, managed by https://github.com/bwplotka/bingo. + +* Run `bingo get` to install all tools having each own module file in this directory. +* Run `bingo get ` to install that have own module file in this directory. +* For Makefile: Make sure to put `include .bingo/Variables.mk` in your Makefile, then use $() variable where is the .bingo/.mod. +* For shell: Run `source .bingo/variables.env` to source all environment variable for each tool. +* For go: Import `.bingo/variables.go` to for variable names. +* See https://github.com/bwplotka/bingo or -h on how to add, remove or change binaries dependencies. + +## Requirements + +* Go 1.14+ diff --git a/.bingo/Variables.mk b/.bingo/Variables.mk new file mode 100644 index 00000000..d160b1f9 --- /dev/null +++ b/.bingo/Variables.mk @@ -0,0 +1,43 @@ +# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.4.0. DO NOT EDIT. +# All tools are designed to be build inside $GOBIN. +BINGO_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +GOPATH ?= $(shell go env GOPATH) +GOBIN ?= $(firstword $(subst :, ,${GOPATH}))/bin +GO ?= $(shell which go) + +# Below generated variables ensure that every time a tool under each variable is invoked, the correct version +# will be used; reinstalling only if needed. +# For example for goimports variable: +# +# In your main Makefile (for non array binaries): +# +#include .bingo/Variables.mk # Assuming -dir was set to .bingo . +# +#command: $(GOIMPORTS) +# @echo "Running goimports" +# @$(GOIMPORTS) +# +GOIMPORTS := $(GOBIN)/goimports-v0.1.0 +$(GOIMPORTS): $(BINGO_DIR)/goimports.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/goimports-v0.1.0" + @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=goimports.mod -o=$(GOBIN)/goimports-v0.1.0 "golang.org/x/tools/cmd/goimports" + +GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.38.0 +$(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/golangci-lint-v1.38.0" + @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.38.0 "github.com/golangci/golangci-lint/cmd/golangci-lint" + +LICENSER := $(GOBIN)/licenser-v0.6.0 +$(LICENSER): $(BINGO_DIR)/licenser.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/licenser-v0.6.0" + @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=licenser.mod -o=$(GOBIN)/licenser-v0.6.0 "github.com/liamawhite/licenser" + +SHFMT := $(GOBIN)/shfmt-v3.2.4 +$(SHFMT): $(BINGO_DIR)/shfmt.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/shfmt-v3.2.4" + @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=shfmt.mod -o=$(GOBIN)/shfmt-v3.2.4 "mvdan.cc/sh/v3/cmd/shfmt" + diff --git a/.bingo/go.mod b/.bingo/go.mod new file mode 100755 index 00000000..610249af --- /dev/null +++ b/.bingo/go.mod @@ -0,0 +1 @@ +module _ // Fake go.mod auto-created by 'bingo' for go -moddir compatibility with non-Go projects. Commit this file, together with other .mod files. \ No newline at end of file diff --git a/.bingo/goimports.mod b/.bingo/goimports.mod new file mode 100644 index 00000000..9ed41ef4 --- /dev/null +++ b/.bingo/goimports.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.16 + +require golang.org/x/tools v0.1.0 // cmd/goimports diff --git a/.bingo/golangci-lint.mod b/.bingo/golangci-lint.mod new file mode 100644 index 00000000..4ae745cd --- /dev/null +++ b/.bingo/golangci-lint.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.16 + +require github.com/golangci/golangci-lint v1.38.0 // cmd/golangci-lint diff --git a/.bingo/licenser.mod b/.bingo/licenser.mod new file mode 100644 index 00000000..f1a6734d --- /dev/null +++ b/.bingo/licenser.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.16 + +require github.com/liamawhite/licenser v0.6.0 diff --git a/.bingo/shfmt.mod b/.bingo/shfmt.mod new file mode 100644 index 00000000..eaebeeb8 --- /dev/null +++ b/.bingo/shfmt.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.16 + +require mvdan.cc/sh/v3 v3.2.4 // cmd/shfmt diff --git a/.bingo/variables.env b/.bingo/variables.env new file mode 100644 index 00000000..6435ff0a --- /dev/null +++ b/.bingo/variables.env @@ -0,0 +1,18 @@ +# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.4.0. DO NOT EDIT. +# All tools are designed to be build inside $GOBIN. +# Those variables will work only until 'bingo get' was invoked, or if tools were installed via Makefile's Variables.mk. +GOBIN=${GOBIN:=$(go env GOBIN)} + +if [ -z "$GOBIN" ]; then + GOBIN="$(go env GOPATH)/bin" +fi + + +GOIMPORTS="${GOBIN}/goimports-v0.1.0" + +GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.38.0" + +LICENSER="${GOBIN}/licenser-v0.6.0" + +SHFMT="${GOBIN}/shfmt-v3.2.4" + diff --git a/.circleci/config.yml b/.circleci/config.yml index 88e68f62..84c3c7a7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,7 +21,7 @@ executors: - image: registry:2 jobs: - lint: + check: executor: builder resource_class: medium+ environment: @@ -32,18 +32,17 @@ jobs: GOMAXPROCS: "3" steps: - checkout - - run: make init - - run: ./ci/install-lint - - run: ./ci/lint - + - run: make check + test: executor: builder resource_class: medium+ steps: - checkout - run: make init - - run: ./ci/install-envoy - - run: ./ci/test + # prefetch latest so that tests run faster + - run: go run cmd/getenvoy/main.go fetch standard:1.17.1 + - run: make test.ci GO_TEST_EXTRA_OPTS="-timeout 60s" - run: name: "Measure test coverage (for now, on a subset of tests)" command: make coverage GO_COVERAGE_EXTRA_OPTS="-p 1" @@ -55,5 +54,5 @@ workflows: version: 2 commit: jobs: - - lint + - check - test diff --git a/.licenserignore b/.licenserignore index 764d6546..0677762e 100644 --- a/.licenserignore +++ b/.licenserignore @@ -6,3 +6,7 @@ go.mod go.sum *.pem + +.bingo +.dockerignore +.idea diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 804a52ae..e31016f8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,8 +4,8 @@ We welcome contributions from the community. Please read the following guideline ## Coding Style -- The code is linted using a relatively stringent [golang-ci config](./.golangci.yml). To run this linter (and a few others) use the `ci/format` script. To verify, you can run the `ci/lint` script. -- We follow standard Go table-driven tests and use the [`testify/assert`](https://github.com/stretchr/testify#assert-package) library to assert correctness. To verify all tests pass, you can run the `ci/test` script. +- The code is linted using a relatively stringent [golang-ci config](./.golangci.yml). To run this linter (and a few others) use run `make check`. To format your files, you can run `make format`. +- We follow standard Go table-driven tests and use the [`testify/assert`](https://github.com/stretchr/testify#assert-package) library to assert correctness. To verify all tests pass, you can run `make test`. ## DCO diff --git a/Makefile b/Makefile index 4674cc0e..8373a8fe 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +# Make sure we pick up any local overrides. +-include .makerc + +# bingo manages go binaries needed for building the project +include .bingo/Variables.mk + ENVOY = standard:1.11.1 HUB ?= docker.io/getenvoy GETENVOY_TAG ?= dev @@ -175,3 +181,55 @@ $(foreach lang,$(BUILDERS_LANGS),$(eval $(call GEN_PULL_EXTENSION_BUILDER_IMAGE_ .PHONY: builders.pull builders.pull: $(foreach lang,$(BUILDERS_LANGS), pull/builder/$(lang)) + +##@ Code quality and integrity + +LINT_OPTS ?= --timeout 5m +.PHONY: lint +# generate must be called while generated source is still used +lint: generate $(GOLANGCI_LINT) $(SHFMT) $(LICENSER) .golangci.yml ## Run the linters + @echo "--- lint ---" + @$(SHFMT) -d . + @$(LICENSER) verify -r . + @$(GOLANGCI_LINT) run $(LINT_OPTS) --config .golangci.yml + +# The goimports tool does not arrange imports in 3 blocks if there are already more than three blocks. +# To avoid that, before running it, we collapse all imports in one block, then run the formatter. +.PHONY: format +format: $(GOIMPORTS) ## Format all Go code + @echo "--- format ---" + @$(LICENSER) apply -r "Tetrate" + @find . -type f -name '*.go' | xargs gofmt -s -w + @for f in `find . -name '*.go'`; do \ + awk '/^import \($$/,/^\)$$/{if($$0=="")next}{print}' $$f > /tmp/fmt; \ + mv /tmp/fmt $$f; \ + $(GOIMPORTS) -w -local github.com/tetratelabs/getenvoy $$f; \ + done + + +# Enforce go version matches what's in go.mod when running `make check` assuming the following: +# * 'go version' returns output like "go version go1.16 darwin/amd64" +# * go.mod contains a line like "go 1.16" +EXPECTED_GO_VERSION_PREFIX := "go version go$(shell sed -ne '/^go /s/.* //gp' go.mod )" +GO_VERSION := $(shell go version) + +.PHONY: check +check: ## CI blocks merge until this passes. If this fails, run "make check" locally and commit the difference. +# case statement because /bin/sh cannot do prefix comparison, awk is awkward and assuming /bin/bash is brittle + @case "$(GO_VERSION)" in $(EXPECTED_GO_VERSION_PREFIX)* ) ;; * ) \ + echo "Expected 'go version' to start with $(EXPECTED_GO_VERSION_PREFIX), but it didn't: $(GO_VERSION)"; \ + exit 1; \ + esac + @$(MAKE) lint + @$(MAKE) format + @go mod tidy + @if [ ! -z "`git status -s`" ]; then \ + echo "The following differences will fail CI until committed:"; \ + git diff; \ + exit 1; \ + fi + +.PHONY: clean +clean: ## Clean all binaries + @echo "--- $@ ---" + go clean -testcache diff --git a/ci/format b/ci/format deleted file mode 100755 index f9efb202..00000000 --- a/ci/format +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# Apply Licenses -licenser apply -r "Tetrate" - -# Misc linters -golangci-lint run -find . -type f -name '*.go' | xargs gofmt -s -w diff --git a/ci/install-envoy b/ci/install-envoy deleted file mode 100755 index d4db8f7f..00000000 --- a/ci/install-envoy +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -# Install Envoy -go run cmd/getenvoy/main.go fetch standard:1.11.0 diff --git a/ci/install-lint b/ci/install-lint deleted file mode 100755 index d847752f..00000000 --- a/ci/install-lint +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e - -SHFMT_VERSION="3.1.1" -LICENSER_VERSION="0.6.0" -GOLANGCI_LINT_VERSION="1.38.0" - -# Install shfmt -wget -c https://github.com/mvdan/sh/releases/download/v${SHFMT_VERSION}/shfmt_v${SHFMT_VERSION}_linux_amd64 -O - | sudo dd of=/usr/bin/shfmt && sudo chmod a+x /usr/bin/shfmt - -# Install Licenser -wget -c https://github.com/liamawhite/licenser/releases/download/v${LICENSER_VERSION}/licenser_${LICENSER_VERSION}_Linux_x86_64.tar.gz -O - | sudo tar -xz -C /usr/bin - -# Install golangci-lint -curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sudo sh -s -- -b /usr/bin v${GOLANGCI_LINT_VERSION} diff --git a/ci/lint b/ci/lint deleted file mode 100755 index 38e312a1..00000000 --- a/ci/lint +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -log_message() { - echo "$*" >&2 -} - -# Ensure formatting of shell scripts. -if shfmt -d .; then - log_message "shfmt passed." -else - log_message "shfmt failed. Run 'shfmt -w .' to automatically fix formatting errors." - exit 1 -fi - -# Ensure Licenses are present -if licenser verify -r .; then - log_message "Licenses are present on all recognised files." -else - log_message "Licenses are missing. Run 'licenser apply -r \"Tetrate\"' to automatically add missing license headers." - exit 1 -fi - -if golangci-lint run; then - log_message "golangci-lint succeded." -else - log_message "golangci-lint failed." - exit 1 -fi diff --git a/ci/test b/ci/test deleted file mode 100755 index ff97c433..00000000 --- a/ci/test +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -BASEDIR=$(dirname "$0") - -make test.ci GO_TEST_EXTRA_OPTS="-timeout 60s" -C "${BASEDIR}/.." diff --git a/data/extension/init/templates/tinygo/envoy.access_loggers/default/main_test.go b/data/extension/init/templates/tinygo/envoy.access_loggers/default/main_test.go index 3fadd353..f5d27b9a 100644 --- a/data/extension/init/templates/tinygo/envoy.access_loggers/default/main_test.go +++ b/data/extension/init/templates/tinygo/envoy.access_loggers/default/main_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/stretchr/testify/require" - "github.com/tetratelabs/proxy-wasm-go-sdk/proxytest" "github.com/tetratelabs/proxy-wasm-go-sdk/proxywasm/types" ) diff --git a/data/extension/init/templates/tinygo/envoy.filters.http/default/main_test.go b/data/extension/init/templates/tinygo/envoy.filters.http/default/main_test.go index e9cf3181..06aedf01 100644 --- a/data/extension/init/templates/tinygo/envoy.filters.http/default/main_test.go +++ b/data/extension/init/templates/tinygo/envoy.filters.http/default/main_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/stretchr/testify/require" - "github.com/tetratelabs/proxy-wasm-go-sdk/proxytest" "github.com/tetratelabs/proxy-wasm-go-sdk/proxywasm/types" ) diff --git a/pkg/binary/envoy/controlplane/istio.go b/pkg/binary/envoy/controlplane/istio.go index 02548f19..8de568ba 100644 --- a/pkg/binary/envoy/controlplane/istio.go +++ b/pkg/binary/envoy/controlplane/istio.go @@ -24,15 +24,14 @@ import ( "github.com/golang/protobuf/ptypes" durationpb "github.com/golang/protobuf/ptypes/duration" - - "github.com/tetratelabs/getenvoy/pkg/binary" - "github.com/tetratelabs/getenvoy/pkg/binary/envoy" "github.com/tetratelabs/log" meshconfig "istio.io/api/mesh/v1alpha1" - "istio.io/istio/pilot/pkg/model" "istio.io/istio/pkg/bootstrap" "istio.io/istio/pkg/config/mesh" + + "github.com/tetratelabs/getenvoy/pkg/binary" + "github.com/tetratelabs/getenvoy/pkg/binary/envoy" ) const ( diff --git a/pkg/binary/envoy/controlplane/istio_test.go b/pkg/binary/envoy/controlplane/istio_test.go index a9224e9e..5205d624 100644 --- a/pkg/binary/envoy/controlplane/istio_test.go +++ b/pkg/binary/envoy/controlplane/istio_test.go @@ -24,11 +24,12 @@ import ( "time" "github.com/stretchr/testify/assert" + "istio.io/istio/pilot/pkg/bootstrap" + "istio.io/istio/tests/util" + "github.com/tetratelabs/getenvoy/pkg/binary/envoy" "github.com/tetratelabs/getenvoy/pkg/binary/envoy/debug" "github.com/tetratelabs/getenvoy/pkg/binary/envoytest" - "istio.io/istio/pilot/pkg/bootstrap" - "istio.io/istio/tests/util" ) func TestMain(m *testing.M) { diff --git a/pkg/binary/envoy/debug/admin.go b/pkg/binary/envoy/debug/admin.go index 79b2d350..d8ad3b84 100644 --- a/pkg/binary/envoy/debug/admin.go +++ b/pkg/binary/envoy/debug/admin.go @@ -23,7 +23,6 @@ import ( "path/filepath" "github.com/tetratelabs/log" - "github.com/tetratelabs/multierror" "github.com/tetratelabs/getenvoy/pkg/binary" diff --git a/pkg/binary/envoy/debug/log.go b/pkg/binary/envoy/debug/log.go index 15110e87..129a7990 100644 --- a/pkg/binary/envoy/debug/log.go +++ b/pkg/binary/envoy/debug/log.go @@ -17,8 +17,9 @@ package debug import ( - "github.com/tetratelabs/getenvoy/pkg/binary/envoy" "github.com/tetratelabs/log" + + "github.com/tetratelabs/getenvoy/pkg/binary/envoy" ) // EnableEnvoyLogCollection is a preset option that registers collection of Envoy Access Logs diff --git a/pkg/binary/envoy/debug/log_linux.go b/pkg/binary/envoy/debug/log_linux.go index bc4c279a..c002c4a4 100644 --- a/pkg/binary/envoy/debug/log_linux.go +++ b/pkg/binary/envoy/debug/log_linux.go @@ -20,9 +20,10 @@ import ( "os" "path/filepath" + "github.com/tetratelabs/log" + "github.com/tetratelabs/getenvoy/pkg/binary" "github.com/tetratelabs/getenvoy/pkg/binary/envoy" - "github.com/tetratelabs/log" ) // EnableEnvoyLogCollection is a preset option that registers collection of Envoy access logs and stderr diff --git a/pkg/binary/envoy/debug/lsof.go b/pkg/binary/envoy/debug/lsof.go index 36b8ab9c..d69c9511 100644 --- a/pkg/binary/envoy/debug/lsof.go +++ b/pkg/binary/envoy/debug/lsof.go @@ -22,10 +22,10 @@ import ( "syscall" "github.com/shirou/gopsutil/process" + "github.com/tetratelabs/log" "github.com/tetratelabs/getenvoy/pkg/binary" "github.com/tetratelabs/getenvoy/pkg/binary/envoy" - "github.com/tetratelabs/log" ) // OpenFileStat defines the structure of statistics about a single opened file diff --git a/pkg/binary/envoy/debug/node.go b/pkg/binary/envoy/debug/node.go index b98d3450..96509acb 100644 --- a/pkg/binary/envoy/debug/node.go +++ b/pkg/binary/envoy/debug/node.go @@ -25,9 +25,10 @@ import ( "github.com/shirou/gopsutil/net" "github.com/shirou/gopsutil/process" + "github.com/tetratelabs/log" + "github.com/tetratelabs/getenvoy/pkg/binary" "github.com/tetratelabs/getenvoy/pkg/binary/envoy" - "github.com/tetratelabs/log" ) // EnableNodeCollection is a preset option that registers collection of node level information for debugging diff --git a/pkg/binary/envoy/fetch.go b/pkg/binary/envoy/fetch.go index 4fda3494..4d4a97e2 100644 --- a/pkg/binary/envoy/fetch.go +++ b/pkg/binary/envoy/fetch.go @@ -17,23 +17,20 @@ package envoy import ( "archive/tar" "errors" + "fmt" + "io" + "io/ioutil" "net/http" + "os" "path/filepath" "strings" - "os" - - "fmt" - - "io/ioutil" - - "io" - "github.com/mholt/archiver" "github.com/schollz/progressbar/v2" + "github.com/tetratelabs/log" + "github.com/tetratelabs/getenvoy/pkg/manifest" "github.com/tetratelabs/getenvoy/pkg/transport" - "github.com/tetratelabs/log" ) const envoyLocation = "bin/envoy" diff --git a/pkg/binary/envoy/fetch_test.go b/pkg/binary/envoy/fetch_test.go index ca338812..30c17344 100644 --- a/pkg/binary/envoy/fetch_test.go +++ b/pkg/binary/envoy/fetch_test.go @@ -18,13 +18,13 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "os" "path/filepath" "testing" - "os" - "github.com/mholt/archiver" "github.com/stretchr/testify/assert" + "github.com/tetratelabs/getenvoy/pkg/manifest" ) diff --git a/pkg/binary/envoy/run.go b/pkg/binary/envoy/run.go index 4aadffeb..7c18d08c 100644 --- a/pkg/binary/envoy/run.go +++ b/pkg/binary/envoy/run.go @@ -27,8 +27,9 @@ import ( "time" "github.com/mholt/archiver" - "github.com/tetratelabs/getenvoy/pkg/manifest" "github.com/tetratelabs/log" + + "github.com/tetratelabs/getenvoy/pkg/manifest" ) // Run execs the binary defined by the key with the args passed diff --git a/pkg/binary/envoy/run_test.go b/pkg/binary/envoy/run_test.go index 834eb4fd..3911a1dd 100644 --- a/pkg/binary/envoy/run_test.go +++ b/pkg/binary/envoy/run_test.go @@ -25,6 +25,7 @@ import ( "time" "github.com/stretchr/testify/assert" + "github.com/tetratelabs/getenvoy/pkg/binary" ) diff --git a/pkg/binary/envoy/runtime.go b/pkg/binary/envoy/runtime.go index 0b835d79..4671a667 100644 --- a/pkg/binary/envoy/runtime.go +++ b/pkg/binary/envoy/runtime.go @@ -26,7 +26,6 @@ import ( "github.com/tetratelabs/getenvoy/pkg/binary" "github.com/tetratelabs/getenvoy/pkg/common" - ioutil "github.com/tetratelabs/getenvoy/pkg/util/io" ) diff --git a/pkg/binary/envoy/start.go b/pkg/binary/envoy/start.go index bf45b297..6083185f 100644 --- a/pkg/binary/envoy/start.go +++ b/pkg/binary/envoy/start.go @@ -15,8 +15,9 @@ package envoy import ( - "github.com/tetratelabs/getenvoy/pkg/binary" "github.com/tetratelabs/log" + + "github.com/tetratelabs/getenvoy/pkg/binary" ) func (r *Runtime) handlePreStart() { diff --git a/pkg/binary/envoy/termination.go b/pkg/binary/envoy/termination.go index 74976d05..f5bb1eb9 100644 --- a/pkg/binary/envoy/termination.go +++ b/pkg/binary/envoy/termination.go @@ -17,8 +17,9 @@ package envoy import ( "syscall" - "github.com/tetratelabs/getenvoy/pkg/binary" "github.com/tetratelabs/log" + + "github.com/tetratelabs/getenvoy/pkg/binary" ) func (r *Runtime) handleTermination() { diff --git a/pkg/binary/envoytest/util.go b/pkg/binary/envoytest/util.go index c4506c00..343c6222 100644 --- a/pkg/binary/envoytest/util.go +++ b/pkg/binary/envoytest/util.go @@ -22,6 +22,7 @@ import ( "time" "github.com/mholt/archiver" + "github.com/tetratelabs/getenvoy/pkg/binary" "github.com/tetratelabs/getenvoy/pkg/binary/envoy" "github.com/tetratelabs/getenvoy/pkg/manifest" diff --git a/pkg/cmd/extension/build/cmd.go b/pkg/cmd/extension/build/cmd.go index bf5fd1c8..58d9466c 100644 --- a/pkg/cmd/extension/build/cmd.go +++ b/pkg/cmd/extension/build/cmd.go @@ -16,7 +16,6 @@ package build // nolint:dupl import ( "github.com/pkg/errors" - "github.com/spf13/cobra" "github.com/tetratelabs/getenvoy/pkg/cmd/extension/common" diff --git a/pkg/cmd/extension/build/cmd_test.go b/pkg/cmd/extension/build/cmd_test.go index 74baf00f..01a5ede4 100644 --- a/pkg/cmd/extension/build/cmd_test.go +++ b/pkg/cmd/extension/build/cmd_test.go @@ -26,9 +26,7 @@ import ( "github.com/spf13/cobra" "github.com/tetratelabs/getenvoy/pkg/cmd" - testcontext "github.com/tetratelabs/getenvoy/pkg/test/cmd/extension" - cmdutil "github.com/tetratelabs/getenvoy/pkg/util/cmd" ) diff --git a/pkg/cmd/extension/clean/cmd.go b/pkg/cmd/extension/clean/cmd.go index 795bc9e4..08ef74b7 100644 --- a/pkg/cmd/extension/clean/cmd.go +++ b/pkg/cmd/extension/clean/cmd.go @@ -16,7 +16,6 @@ package clean // nolint:dupl import ( "github.com/pkg/errors" - "github.com/spf13/cobra" "github.com/tetratelabs/getenvoy/pkg/cmd/extension/common" diff --git a/pkg/cmd/extension/clean/cmd_test.go b/pkg/cmd/extension/clean/cmd_test.go index dbfcf113..50389ab4 100644 --- a/pkg/cmd/extension/clean/cmd_test.go +++ b/pkg/cmd/extension/clean/cmd_test.go @@ -26,9 +26,7 @@ import ( "github.com/spf13/cobra" "github.com/tetratelabs/getenvoy/pkg/cmd" - testcontext "github.com/tetratelabs/getenvoy/pkg/test/cmd/extension" - cmdutil "github.com/tetratelabs/getenvoy/pkg/util/cmd" ) diff --git a/pkg/cmd/extension/common/toolchain.go b/pkg/cmd/extension/common/toolchain.go index b47ed8d2..9ce08f70 100644 --- a/pkg/cmd/extension/common/toolchain.go +++ b/pkg/cmd/extension/common/toolchain.go @@ -15,11 +15,10 @@ package common import ( + "github.com/docker/distribution/reference" "github.com/pkg/errors" "github.com/spf13/cobra" - "github.com/docker/distribution/reference" - builtinconfig "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/toolchain/builtin" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/model" toolchains "github.com/tetratelabs/getenvoy/pkg/extension/workspace/toolchain" diff --git a/pkg/cmd/extension/example/cmd_add_test.go b/pkg/cmd/extension/example/cmd_add_test.go index 02fd70b6..285021ea 100644 --- a/pkg/cmd/extension/example/cmd_add_test.go +++ b/pkg/cmd/extension/example/cmd_add_test.go @@ -24,11 +24,9 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/otiai10/copy" - "github.com/spf13/cobra" "github.com/tetratelabs/getenvoy/pkg/cmd" - cmdutil "github.com/tetratelabs/getenvoy/pkg/util/cmd" ) diff --git a/pkg/cmd/extension/example/cmd_list_test.go b/pkg/cmd/extension/example/cmd_list_test.go index 7268e791..173c6f32 100644 --- a/pkg/cmd/extension/example/cmd_list_test.go +++ b/pkg/cmd/extension/example/cmd_list_test.go @@ -22,11 +22,9 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/spf13/cobra" "github.com/tetratelabs/getenvoy/pkg/cmd" - cmdutil "github.com/tetratelabs/getenvoy/pkg/util/cmd" ) diff --git a/pkg/cmd/extension/example/cmd_remove_test.go b/pkg/cmd/extension/example/cmd_remove_test.go index 873e86a5..944c5a3d 100644 --- a/pkg/cmd/extension/example/cmd_remove_test.go +++ b/pkg/cmd/extension/example/cmd_remove_test.go @@ -24,11 +24,9 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/otiai10/copy" - "github.com/spf13/cobra" "github.com/tetratelabs/getenvoy/pkg/cmd" - cmdutil "github.com/tetratelabs/getenvoy/pkg/util/cmd" ) diff --git a/pkg/cmd/extension/init/cmd_test.go b/pkg/cmd/extension/init/cmd_test.go index 7ceb39e8..8d5a769f 100644 --- a/pkg/cmd/extension/init/cmd_test.go +++ b/pkg/cmd/extension/init/cmd_test.go @@ -23,7 +23,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" - "github.com/spf13/cobra" "github.com/tetratelabs/getenvoy/pkg/cmd" diff --git a/pkg/cmd/extension/init/feedback.go b/pkg/cmd/extension/init/feedback.go index 3e0f0401..c5d679a9 100644 --- a/pkg/cmd/extension/init/feedback.go +++ b/pkg/cmd/extension/init/feedback.go @@ -19,6 +19,7 @@ import ( "io" "github.com/spf13/cobra" + scaffold "github.com/tetratelabs/getenvoy/pkg/extension/init" uiutil "github.com/tetratelabs/getenvoy/pkg/util/ui" ) diff --git a/pkg/cmd/extension/init/feedback_test.go b/pkg/cmd/extension/init/feedback_test.go index c9996852..53333812 100644 --- a/pkg/cmd/extension/init/feedback_test.go +++ b/pkg/cmd/extension/init/feedback_test.go @@ -20,7 +20,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" - "github.com/spf13/cobra" scaffold "github.com/tetratelabs/getenvoy/pkg/extension/init" diff --git a/pkg/cmd/extension/init/params.go b/pkg/cmd/extension/init/params.go index fc1de866..0e6b4793 100644 --- a/pkg/cmd/extension/init/params.go +++ b/pkg/cmd/extension/init/params.go @@ -22,7 +22,6 @@ import ( scaffold "github.com/tetratelabs/getenvoy/pkg/extension/init" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" - osutil "github.com/tetratelabs/getenvoy/pkg/util/os" ) diff --git a/pkg/cmd/extension/init/wizard_test.go b/pkg/cmd/extension/init/wizard_test.go index f4a5b843..0292ded8 100644 --- a/pkg/cmd/extension/init/wizard_test.go +++ b/pkg/cmd/extension/init/wizard_test.go @@ -23,7 +23,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" - "github.com/spf13/cobra" uiutil "github.com/tetratelabs/getenvoy/pkg/util/ui" diff --git a/pkg/cmd/extension/root_test.go b/pkg/cmd/extension/root_test.go index 316636d0..81f59dbb 100644 --- a/pkg/cmd/extension/root_test.go +++ b/pkg/cmd/extension/root_test.go @@ -24,7 +24,6 @@ import ( "github.com/tetratelabs/getenvoy/pkg/cmd" "github.com/tetratelabs/getenvoy/pkg/cmd/extension/globals" - cmdutil "github.com/tetratelabs/getenvoy/pkg/util/cmd" ) diff --git a/pkg/cmd/extension/test/cmd.go b/pkg/cmd/extension/test/cmd.go index 53ab0ca7..bc5b4f15 100644 --- a/pkg/cmd/extension/test/cmd.go +++ b/pkg/cmd/extension/test/cmd.go @@ -16,7 +16,6 @@ package test // nolint:dupl import ( "github.com/pkg/errors" - "github.com/spf13/cobra" "github.com/tetratelabs/getenvoy/pkg/cmd/extension/common" diff --git a/pkg/cmd/extension/test/cmd_test.go b/pkg/cmd/extension/test/cmd_test.go index ead5abe4..f4204edb 100644 --- a/pkg/cmd/extension/test/cmd_test.go +++ b/pkg/cmd/extension/test/cmd_test.go @@ -26,9 +26,7 @@ import ( "github.com/spf13/cobra" "github.com/tetratelabs/getenvoy/pkg/cmd" - testcontext "github.com/tetratelabs/getenvoy/pkg/test/cmd/extension" - cmdutil "github.com/tetratelabs/getenvoy/pkg/util/cmd" ) diff --git a/pkg/cmd/fetch.go b/pkg/cmd/fetch.go index 83610eb5..c7fca253 100644 --- a/pkg/cmd/fetch.go +++ b/pkg/cmd/fetch.go @@ -18,6 +18,7 @@ import ( "errors" "github.com/spf13/cobra" + "github.com/tetratelabs/getenvoy/pkg/binary/envoy" "github.com/tetratelabs/getenvoy/pkg/manifest" ) diff --git a/pkg/cmd/list.go b/pkg/cmd/list.go index 1cbcfb07..32b2f45f 100644 --- a/pkg/cmd/list.go +++ b/pkg/cmd/list.go @@ -18,6 +18,7 @@ import ( "os" "github.com/spf13/cobra" + "github.com/tetratelabs/getenvoy/pkg/manifest" ) diff --git a/pkg/cmd/root.go b/pkg/cmd/root.go index be1d4ce7..80c56bf8 100644 --- a/pkg/cmd/root.go +++ b/pkg/cmd/root.go @@ -18,18 +18,15 @@ import ( "os" "strconv" - "github.com/tetratelabs/log" - "github.com/pkg/errors" - "github.com/spf13/cobra" + "github.com/tetratelabs/log" "github.com/tetratelabs/getenvoy/pkg/cmd/extension" "github.com/tetratelabs/getenvoy/pkg/common" "github.com/tetratelabs/getenvoy/pkg/manifest" - "github.com/tetratelabs/getenvoy/pkg/version" - osutil "github.com/tetratelabs/getenvoy/pkg/util/os" + "github.com/tetratelabs/getenvoy/pkg/version" ) // globalOpts represents options that affect all getenvoy sub-commands. diff --git a/pkg/cmd/root_test.go b/pkg/cmd/root_test.go index 334aae47..3bb1df50 100644 --- a/pkg/cmd/root_test.go +++ b/pkg/cmd/root_test.go @@ -21,17 +21,14 @@ import ( "path/filepath" "strings" + "github.com/mitchellh/go-homedir" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/spf13/cobra" - "github.com/mitchellh/go-homedir" - . "github.com/tetratelabs/getenvoy/pkg/cmd" "github.com/tetratelabs/getenvoy/pkg/common" "github.com/tetratelabs/getenvoy/pkg/manifest" - cmdutil "github.com/tetratelabs/getenvoy/pkg/util/cmd" ) diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go index ed9ecbd5..e2af8369 100644 --- a/pkg/cmd/run.go +++ b/pkg/cmd/run.go @@ -20,15 +20,14 @@ import ( "strings" "github.com/spf13/cobra" + "github.com/tetratelabs/getenvoy/pkg/binary/envoy" "github.com/tetratelabs/getenvoy/pkg/binary/envoy/controlplane" "github.com/tetratelabs/getenvoy/pkg/binary/envoy/debug" - - cmdutil "github.com/tetratelabs/getenvoy/pkg/util/cmd" - "github.com/tetratelabs/getenvoy/pkg/flavors" _ "github.com/tetratelabs/getenvoy/pkg/flavors/postgres" //nolint "github.com/tetratelabs/getenvoy/pkg/manifest" + cmdutil "github.com/tetratelabs/getenvoy/pkg/util/cmd" ) var ( diff --git a/pkg/common/home.go b/pkg/common/home.go index bb68a213..2568d4e5 100644 --- a/pkg/common/home.go +++ b/pkg/common/home.go @@ -17,9 +17,8 @@ package common import ( "path/filepath" - "github.com/tetratelabs/log" - "github.com/mitchellh/go-homedir" + "github.com/tetratelabs/log" ) var ( diff --git a/pkg/extension/example/init/registry/default.go b/pkg/extension/example/init/registry/default.go index 38fcef54..bd5e3c06 100644 --- a/pkg/extension/example/init/registry/default.go +++ b/pkg/extension/example/init/registry/default.go @@ -23,7 +23,6 @@ import ( // force execution of auto generated code _ "github.com/tetratelabs/getenvoy/pkg/extension/example/init/registry/templates" - "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" ) diff --git a/pkg/extension/example/init/registry/interfaces.go b/pkg/extension/example/init/registry/interfaces.go index 0df24e23..8a5cb0a0 100644 --- a/pkg/extension/example/init/registry/interfaces.go +++ b/pkg/extension/example/init/registry/interfaces.go @@ -15,9 +15,8 @@ package registry import ( - "github.com/tetratelabs/getenvoy/pkg/extension/workspace/model" - "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" + "github.com/tetratelabs/getenvoy/pkg/extension/workspace/model" ) const ( diff --git a/pkg/extension/init/descriptor_test.go b/pkg/extension/init/descriptor_test.go index 3d5fead0..fd045acb 100644 --- a/pkg/extension/init/descriptor_test.go +++ b/pkg/extension/init/descriptor_test.go @@ -20,7 +20,6 @@ import ( . "github.com/onsi/gomega" . "github.com/tetratelabs/getenvoy/pkg/extension/init" - "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" ) diff --git a/pkg/extension/init/init.go b/pkg/extension/init/init.go index d383523e..d8d01a49 100644 --- a/pkg/extension/init/init.go +++ b/pkg/extension/init/init.go @@ -29,7 +29,6 @@ import ( "github.com/tetratelabs/multierror" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" - osutil "github.com/tetratelabs/getenvoy/pkg/util/os" scaffoldutil "github.com/tetratelabs/getenvoy/pkg/util/scaffold" ) diff --git a/pkg/extension/workspace/config/extension/extension_test.go b/pkg/extension/workspace/config/extension/extension_test.go index de633d85..988014e9 100644 --- a/pkg/extension/workspace/config/extension/extension_test.go +++ b/pkg/extension/workspace/config/extension/extension_test.go @@ -21,9 +21,8 @@ import ( . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" - . "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" - "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config" + . "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" ) var _ = Describe("Extension", func() { diff --git a/pkg/extension/workspace/config/toolchain/builtin/helpers.go b/pkg/extension/workspace/config/toolchain/builtin/helpers.go index 8811ed46..4282eb18 100644 --- a/pkg/extension/workspace/config/toolchain/builtin/helpers.go +++ b/pkg/extension/workspace/config/toolchain/builtin/helpers.go @@ -17,10 +17,10 @@ package builtin import ( "path" + "github.com/docker/distribution/reference" "github.com/pkg/errors" "github.com/tetratelabs/multierror" - "github.com/docker/distribution/reference" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config" ) diff --git a/pkg/extension/workspace/config/toolchain/builtin/helpers_test.go b/pkg/extension/workspace/config/toolchain/builtin/helpers_test.go index 65b83b59..6f5044d9 100644 --- a/pkg/extension/workspace/config/toolchain/builtin/helpers_test.go +++ b/pkg/extension/workspace/config/toolchain/builtin/helpers_test.go @@ -20,7 +20,6 @@ import ( . "github.com/onsi/gomega" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config" - . "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/toolchain/builtin" ) diff --git a/pkg/extension/workspace/example/envoy/template/data.go b/pkg/extension/workspace/example/envoy/template/data.go index 76afd18f..51764560 100644 --- a/pkg/extension/workspace/example/envoy/template/data.go +++ b/pkg/extension/workspace/example/envoy/template/data.go @@ -15,14 +15,12 @@ package template import ( - "github.com/pkg/errors" - + envoycore "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes/wrappers" - - envoycore "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" + "github.com/pkg/errors" ) // newExpandData creates a template data object for the Expand operation. diff --git a/pkg/extension/workspace/example/envoy/template/defaults.go b/pkg/extension/workspace/example/envoy/template/defaults.go index 0d264a74..89e563e4 100644 --- a/pkg/extension/workspace/example/envoy/template/defaults.go +++ b/pkg/extension/workspace/example/envoy/template/defaults.go @@ -15,13 +15,11 @@ package template import ( - "github.com/pkg/errors" - - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes/wrappers" - envoybootstrap "github.com/envoyproxy/go-control-plane/envoy/config/bootstrap/v3" envoycore "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes/wrappers" + "github.com/pkg/errors" ) // List of properties supported by the {{ .GetEnvoy.DefaultValue "" }} placeholder. diff --git a/pkg/extension/workspace/example/envoy/template/expand_test.go b/pkg/extension/workspace/example/envoy/template/expand_test.go index cc832303..1b2a2f73 100644 --- a/pkg/extension/workspace/example/envoy/template/expand_test.go +++ b/pkg/extension/workspace/example/envoy/template/expand_test.go @@ -19,10 +19,9 @@ import ( . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" - . "github.com/tetratelabs/getenvoy/pkg/extension/workspace/example/envoy/template" - "github.com/tetratelabs/getenvoy/pkg/extension/manager" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" + . "github.com/tetratelabs/getenvoy/pkg/extension/workspace/example/envoy/template" ) var _ = Describe("Expand()", func() { diff --git a/pkg/extension/workspace/example/envoy/util/load.go b/pkg/extension/workspace/example/envoy/util/load.go index 891688b0..8ab1edf3 100644 --- a/pkg/extension/workspace/example/envoy/util/load.go +++ b/pkg/extension/workspace/example/envoy/util/load.go @@ -17,14 +17,11 @@ package util import ( "bytes" - "github.com/pkg/errors" - + envoymatcher "github.com/envoyproxy/go-control-plane/envoy/type/matcher/v3" "github.com/ghodss/yaml" - "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" - - envoymatcher "github.com/envoyproxy/go-control-plane/envoy/type/matcher/v3" + "github.com/pkg/errors" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/model" ) diff --git a/pkg/extension/workspace/example/envoy/util/load_test.go b/pkg/extension/workspace/example/envoy/util/load_test.go index 522ec364..76149b2b 100644 --- a/pkg/extension/workspace/example/envoy/util/load_test.go +++ b/pkg/extension/workspace/example/envoy/util/load_test.go @@ -18,14 +18,12 @@ import ( "reflect" "strings" + envoylistener "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" + "github.com/golang/protobuf/proto" . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" - "github.com/golang/protobuf/proto" - - envoylistener "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" - "github.com/tetratelabs/getenvoy/pkg/extension/workspace/model" ) diff --git a/pkg/extension/workspace/example/runtime/configdir/configdir.go b/pkg/extension/workspace/example/runtime/configdir/configdir.go index 9fa9ce6a..53cf2cd6 100644 --- a/pkg/extension/workspace/example/runtime/configdir/configdir.go +++ b/pkg/extension/workspace/example/runtime/configdir/configdir.go @@ -22,6 +22,7 @@ import ( envoybootstrap "github.com/envoyproxy/go-control-plane/envoy/config/bootstrap/v3" "github.com/pkg/errors" + "github.com/tetratelabs/multierror" "github.com/tetratelabs/getenvoy/pkg/extension/manager" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/example/envoy/template" @@ -29,7 +30,6 @@ import ( "github.com/tetratelabs/getenvoy/pkg/extension/workspace/example/runtime" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/model" osutil "github.com/tetratelabs/getenvoy/pkg/util/os" - "github.com/tetratelabs/multierror" ) // NewConfigDir creates a config directory for a single example run. diff --git a/pkg/extension/workspace/example/runtime/getenvoy/runtime.go b/pkg/extension/workspace/example/runtime/getenvoy/runtime.go index e0a43c27..3e3d779f 100644 --- a/pkg/extension/workspace/example/runtime/getenvoy/runtime.go +++ b/pkg/extension/workspace/example/runtime/getenvoy/runtime.go @@ -21,7 +21,6 @@ import ( "github.com/tetratelabs/getenvoy/pkg/binary/envoy/debug" types "github.com/tetratelabs/getenvoy/pkg/extension/workspace/example/runtime" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/example/runtime/configdir" - executil "github.com/tetratelabs/getenvoy/pkg/util/exec" ) diff --git a/pkg/extension/workspace/example/runtime/getenvoy/runtime_test.go b/pkg/extension/workspace/example/runtime/getenvoy/runtime_test.go index f884cfad..61cae555 100644 --- a/pkg/extension/workspace/example/runtime/getenvoy/runtime_test.go +++ b/pkg/extension/workspace/example/runtime/getenvoy/runtime_test.go @@ -25,13 +25,11 @@ import ( . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" - . "github.com/tetratelabs/getenvoy/pkg/extension/workspace/example/runtime/getenvoy" - "github.com/tetratelabs/getenvoy/pkg/common" workspaces "github.com/tetratelabs/getenvoy/pkg/extension/workspace" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/example/runtime" + . "github.com/tetratelabs/getenvoy/pkg/extension/workspace/example/runtime/getenvoy" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/model" - argutil "github.com/tetratelabs/getenvoy/pkg/util/args" ioutil "github.com/tetratelabs/getenvoy/pkg/util/io" ) diff --git a/pkg/extension/workspace/example/runtime/getenvoy/testdata/.licenserignore b/pkg/extension/workspace/example/runtime/getenvoy/testdata/.licenserignore new file mode 100644 index 00000000..0f2cfc01 --- /dev/null +++ b/pkg/extension/workspace/example/runtime/getenvoy/testdata/.licenserignore @@ -0,0 +1,2 @@ +# shell script +/envoy/bin/envoy diff --git a/pkg/extension/workspace/example/scaffold.go b/pkg/extension/workspace/example/scaffold.go index d1cd583e..b6813965 100644 --- a/pkg/extension/workspace/example/scaffold.go +++ b/pkg/extension/workspace/example/scaffold.go @@ -19,7 +19,6 @@ import ( "github.com/tetratelabs/getenvoy/pkg/extension/example/init/registry" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/model" - scaffoldutil "github.com/tetratelabs/getenvoy/pkg/util/scaffold" ) diff --git a/pkg/extension/workspace/model/interfaces.go b/pkg/extension/workspace/model/interfaces.go index 633a56eb..38f34ee1 100644 --- a/pkg/extension/workspace/model/interfaces.go +++ b/pkg/extension/workspace/model/interfaces.go @@ -18,7 +18,6 @@ import ( exampleconfig "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/example" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/fs" - scaffoldutil "github.com/tetratelabs/getenvoy/pkg/util/scaffold" ) diff --git a/pkg/extension/workspace/model/workspace.go b/pkg/extension/workspace/model/workspace.go index d40ce401..7886a12d 100644 --- a/pkg/extension/workspace/model/workspace.go +++ b/pkg/extension/workspace/model/workspace.go @@ -18,6 +18,7 @@ import ( "path/filepath" "github.com/pkg/errors" + "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/fs" diff --git a/pkg/extension/workspace/toolchain/builtin/example_config.go b/pkg/extension/workspace/toolchain/builtin/example_config.go index 6f460536..2e0992ad 100644 --- a/pkg/extension/workspace/toolchain/builtin/example_config.go +++ b/pkg/extension/workspace/toolchain/builtin/example_config.go @@ -19,6 +19,7 @@ import ( "text/template" "github.com/pkg/errors" + extensionconfig "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" builtinconfig "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/toolchain/builtin" ) diff --git a/pkg/extension/workspace/toolchain/builtin/factory_test.go b/pkg/extension/workspace/toolchain/builtin/factory_test.go index 26e455b0..213d5a08 100644 --- a/pkg/extension/workspace/toolchain/builtin/factory_test.go +++ b/pkg/extension/workspace/toolchain/builtin/factory_test.go @@ -19,13 +19,12 @@ import ( . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" - . "github.com/tetratelabs/getenvoy/pkg/extension/workspace/toolchain/builtin" - workspaces "github.com/tetratelabs/getenvoy/pkg/extension/workspace" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config" extensionconfig "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" builtinconfig "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/toolchain/builtin" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/model" + . "github.com/tetratelabs/getenvoy/pkg/extension/workspace/toolchain/builtin" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/toolchain/registry" ) diff --git a/pkg/extension/workspace/toolchain/builtin/testdata/.licenserignore b/pkg/extension/workspace/toolchain/builtin/testdata/.licenserignore index d3684286..ed43d605 100644 --- a/pkg/extension/workspace/toolchain/builtin/testdata/.licenserignore +++ b/pkg/extension/workspace/toolchain/builtin/testdata/.licenserignore @@ -1,3 +1,5 @@ /default_config/ /example_config/ /workspace/ +# shell script +/toolchain/docker diff --git a/pkg/extension/workspace/toolchain/builtin/toolchain.go b/pkg/extension/workspace/toolchain/builtin/toolchain.go index cce6ea5e..82f7a246 100644 --- a/pkg/extension/workspace/toolchain/builtin/toolchain.go +++ b/pkg/extension/workspace/toolchain/builtin/toolchain.go @@ -21,7 +21,6 @@ import ( "path/filepath" config "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/toolchain/builtin" - "github.com/tetratelabs/getenvoy/pkg/extension/workspace/model" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/toolchain/types" executil "github.com/tetratelabs/getenvoy/pkg/util/exec" diff --git a/pkg/extension/workspace/toolchain/builtin/toolchain_test.go b/pkg/extension/workspace/toolchain/builtin/toolchain_test.go index 2c254718..78cf78b4 100644 --- a/pkg/extension/workspace/toolchain/builtin/toolchain_test.go +++ b/pkg/extension/workspace/toolchain/builtin/toolchain_test.go @@ -28,12 +28,11 @@ import ( . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" - . "github.com/tetratelabs/getenvoy/pkg/extension/workspace/toolchain/builtin" - workspaces "github.com/tetratelabs/getenvoy/pkg/extension/workspace" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config" builtinconfig "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/toolchain/builtin" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/model" + . "github.com/tetratelabs/getenvoy/pkg/extension/workspace/toolchain/builtin" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/toolchain/types" ioutil "github.com/tetratelabs/getenvoy/pkg/util/io" ) diff --git a/pkg/flavors/postgres/postgres.go b/pkg/flavors/postgres/postgres.go index 34ad6776..6a6bbf25 100644 --- a/pkg/flavors/postgres/postgres.go +++ b/pkg/flavors/postgres/postgres.go @@ -22,8 +22,9 @@ import ( "text/template" valid "github.com/asaskevich/govalidator" - "github.com/tetratelabs/getenvoy/pkg/flavors" "github.com/tetratelabs/log" + + "github.com/tetratelabs/getenvoy/pkg/flavors" ) // Define template parameter names diff --git a/pkg/manifest/locate.go b/pkg/manifest/locate.go index 6298cdf2..9be1d0eb 100644 --- a/pkg/manifest/locate.go +++ b/pkg/manifest/locate.go @@ -21,10 +21,10 @@ import ( "strings" "github.com/pkg/errors" + "github.com/tetratelabs/log" "github.com/tetratelabs/getenvoy-package/api" "github.com/tetratelabs/getenvoy/pkg/types" - "github.com/tetratelabs/log" ) const ( diff --git a/pkg/manifest/print.go b/pkg/manifest/print.go index 79e650eb..b0f1a90b 100644 --- a/pkg/manifest/print.go +++ b/pkg/manifest/print.go @@ -23,6 +23,7 @@ import ( "text/tabwriter" "github.com/golang/protobuf/jsonpb" + "github.com/tetratelabs/getenvoy-package/api" "github.com/tetratelabs/getenvoy/pkg/transport" ) diff --git a/pkg/manifest/print_test.go b/pkg/manifest/print_test.go index 6326d112..a6d3088b 100644 --- a/pkg/manifest/print_test.go +++ b/pkg/manifest/print_test.go @@ -23,6 +23,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/tetratelabs/getenvoy-package/api" ) diff --git a/pkg/pii/pii.go b/pkg/pii/pii.go index 38145edd..839c7117 100644 --- a/pkg/pii/pii.go +++ b/pkg/pii/pii.go @@ -19,7 +19,6 @@ import ( "fmt" "bitbucket.org/creachadair/shell" - l "github.com/tetratelabs/log" ) diff --git a/pkg/test/manifest/server.go b/pkg/test/manifest/server.go index 00e06c6b..535db1dd 100644 --- a/pkg/test/manifest/server.go +++ b/pkg/test/manifest/server.go @@ -23,14 +23,12 @@ import ( "path/filepath" "strings" - "github.com/pkg/errors" - "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" + "github.com/mholt/archiver" + "github.com/pkg/errors" "github.com/tetratelabs/getenvoy-package/api" - - "github.com/mholt/archiver" ) const ( diff --git a/pkg/util/args/args.go b/pkg/util/args/args.go index 51771f5a..b2806ad0 100644 --- a/pkg/util/args/args.go +++ b/pkg/util/args/args.go @@ -15,9 +15,8 @@ package args import ( - "github.com/pkg/errors" - "github.com/mattn/go-shellwords" + "github.com/pkg/errors" ) // SplitCommandLine splits fragments of a command line down to individual arguments. diff --git a/pkg/util/cmd/cmd_test.go b/pkg/util/cmd/cmd_test.go index 5d89535b..1bf1b462 100644 --- a/pkg/util/cmd/cmd_test.go +++ b/pkg/util/cmd/cmd_test.go @@ -18,17 +18,14 @@ import ( "bytes" "syscall" - "github.com/pkg/errors" - - "github.com/spf13/cobra" - . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" - - . "github.com/tetratelabs/getenvoy/pkg/util/cmd" + "github.com/pkg/errors" + "github.com/spf13/cobra" commonerrors "github.com/tetratelabs/getenvoy/pkg/errors" + . "github.com/tetratelabs/getenvoy/pkg/util/cmd" ) var _ = Describe("Execute()", func() { diff --git a/pkg/util/cmd/errors/handlers.go b/pkg/util/cmd/errors/handlers.go index 166a7978..7ee2cf5f 100644 --- a/pkg/util/cmd/errors/handlers.go +++ b/pkg/util/cmd/errors/handlers.go @@ -20,6 +20,7 @@ import ( "strings" "github.com/spf13/cobra" + commonerrors "github.com/tetratelabs/getenvoy/pkg/errors" ) diff --git a/pkg/util/cmd/run_test.go b/pkg/util/cmd/run_test.go index fc3629f9..c017c327 100644 --- a/pkg/util/cmd/run_test.go +++ b/pkg/util/cmd/run_test.go @@ -17,10 +17,9 @@ package cmd_test import ( "errors" - "github.com/spf13/cobra" - . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + "github.com/spf13/cobra" . "github.com/tetratelabs/getenvoy/pkg/util/cmd" ) diff --git a/test/e2e/getenvoy_extension_run_test.go b/test/e2e/getenvoy_extension_run_test.go index dc93de46..8bb7c47f 100644 --- a/test/e2e/getenvoy_extension_run_test.go +++ b/test/e2e/getenvoy_extension_run_test.go @@ -23,14 +23,12 @@ import ( "sync" "time" + "github.com/mholt/archiver" . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" - "github.com/mholt/archiver" - "github.com/tetratelabs/getenvoy/pkg/common" - e2e "github.com/tetratelabs/getenvoy/test/e2e/util" utilenvoy "github.com/tetratelabs/getenvoy/test/e2e/util/envoy" ) From 0f37495e2bd5def35117a11925cf72a46646faea Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Fri, 26 Mar 2021 10:21:54 +0800 Subject: [PATCH 2/2] documents hard-coded strangeness Signed-off-by: Adrian Cole --- .circleci/config.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 84c3c7a7..7d44b307 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,8 +40,9 @@ jobs: steps: - checkout - run: make init - # prefetch latest so that tests run faster - - run: go run cmd/getenvoy/main.go fetch standard:1.17.1 + # prefetch implicit version needed by pkg/binary/envoy/controlplane/istio_test.go until #136. This avoids: + # Unable to start Envoy process: fork/exec /home/circleci/.getenvoy/builds/standard/1.11.0/linux_glibc/bin/envoy: text file busy + - run: go run cmd/getenvoy/main.go fetch standard:1.11.0 - run: make test.ci GO_TEST_EXTRA_OPTS="-timeout 60s" - run: name: "Measure test coverage (for now, on a subset of tests)"