From dd0b482569cfd6b53a9681f9e69e600c5d1a50d5 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Thu, 25 Mar 2021 12:58:53 +0800 Subject: [PATCH] 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. 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 | 10 ++-- .gitignore | 1 + .golangci.yml | 50 ++----------------- .licenserignore | 4 ++ CONTRIBUTING.md | 2 +- Makefile | 35 +++++++++++++ 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/config.go | 2 +- pkg/binary/envoy/controlplane/istio.go | 2 - pkg/binary/envoy/controlplane/istio.tmpl.go | 2 +- pkg/binary/envoy/debug/admin.go | 7 ++- pkg/binary/envoy/debug/lsof.go | 1 - pkg/binary/envoy/fetch.go | 15 +++--- pkg/binary/envoy/fetch_test.go | 3 +- pkg/binary/envoy/runtime.go | 1 - pkg/cmd/extension/build/cmd.go | 2 - pkg/cmd/extension/build/cmd_test.go | 3 -- pkg/cmd/extension/clean/cmd.go | 2 - pkg/cmd/extension/clean/cmd_test.go | 3 -- pkg/cmd/extension/common/toolchain.go | 4 +- pkg/cmd/extension/example/cmd_add.go | 1 - pkg/cmd/extension/example/cmd_add_test.go | 3 -- pkg/cmd/extension/example/cmd_list.go | 1 - pkg/cmd/extension/example/cmd_list_test.go | 3 -- pkg/cmd/extension/example/cmd_remove.go | 1 - pkg/cmd/extension/example/cmd_remove_test.go | 3 -- pkg/cmd/extension/example/feedback.go | 1 - pkg/cmd/extension/init/cmd.go | 1 - pkg/cmd/extension/init/cmd_test.go | 2 - pkg/cmd/extension/init/feedback_test.go | 2 - pkg/cmd/extension/init/params.go | 2 - pkg/cmd/extension/init/wizard.go | 1 - pkg/cmd/extension/init/wizard_test.go | 2 - pkg/cmd/extension/push/cmd.go | 1 - pkg/cmd/extension/push/cmd_test.go | 1 - pkg/cmd/extension/root.go | 1 - pkg/cmd/extension/root_test.go | 2 - pkg/cmd/extension/run/cmd.go | 1 - pkg/cmd/extension/run/cmd_test.go | 7 ++- pkg/cmd/extension/test/cmd.go | 2 - pkg/cmd/extension/test/cmd_test.go | 3 -- pkg/cmd/root.go | 8 +-- pkg/cmd/root_test.go | 6 +-- pkg/cmd/run.go | 4 +- pkg/common/home.go | 3 +- .../example/init/registry/default.go | 1 - .../example/init/registry/interfaces.go | 3 +- pkg/extension/example/init/registry/types.go | 1 - pkg/extension/init/descriptor.go | 1 - pkg/extension/init/descriptor_test.go | 2 - pkg/extension/init/init.go | 4 +- pkg/extension/init/init_test.go | 1 - pkg/extension/init/source.go | 1 - pkg/extension/init/sources.go | 3 +- pkg/extension/init/workspace.go | 1 - pkg/extension/wasmimage/puller.go | 6 +-- pkg/extension/wasmimage/pusher.go | 4 +- .../workspace/config/example/helpers.go | 3 +- .../config/extension/extension_test.go | 4 +- .../workspace/config/extension/helpers.go | 3 +- .../config/toolchain/builtin/helpers.go | 5 +- .../config/toolchain/builtin/helpers_test.go | 2 - .../workspace/example/envoy/template/data.go | 6 +-- .../example/envoy/template/defaults.go | 8 ++- .../example/envoy/template/expand.go | 1 - .../example/envoy/template/expand_test.go | 4 +- .../workspace/example/envoy/util/load.go | 8 +-- .../workspace/example/envoy/util/load_test.go | 7 +-- pkg/extension/workspace/example/lookup.go | 1 - .../example/runtime/configdir/configdir.go | 3 +- .../runtime/configdir/configdir_test.go | 1 - .../example/runtime/getenvoy/runtime.go | 4 +- .../example/runtime/getenvoy/runtime_test.go | 5 +- .../runtime/getenvoy/testdata/.licenserignore | 2 + pkg/extension/workspace/example/scaffold.go | 2 - pkg/extension/workspace/fs/lookup.go | 1 - pkg/extension/workspace/fs/types.go | 3 +- pkg/extension/workspace/model/example.go | 1 - pkg/extension/workspace/model/interfaces.go | 1 - .../toolchain/builtin/default_config.go | 1 - .../toolchain/builtin/default_config_test.go | 1 - .../toolchain/builtin/example_config_test.go | 1 - .../toolchain/builtin/factory_test.go | 4 +- .../builtin/testdata/.licenserignore | 2 + .../workspace/toolchain/builtin/toolchain.go | 1 - .../toolchain/builtin/toolchain_test.go | 4 +- pkg/extension/workspace/toolchain/lookup.go | 1 - .../workspace/toolchain/lookup_test.go | 1 - pkg/manifest/locate.go | 1 - pkg/pii/pii.go | 1 - pkg/test/cmd/extension/context.go | 1 - pkg/test/manifest/platform.go | 1 - pkg/test/manifest/server.go | 7 +-- pkg/types/types_test.go | 1 - pkg/util/args/args.go | 3 +- pkg/util/args/args_test.go | 1 - pkg/util/cmd/cmd.go | 1 - pkg/util/cmd/cmd_test.go | 10 ++-- pkg/util/cmd/io.go | 1 - pkg/util/cmd/run_test.go | 4 +- pkg/util/exec/exec.go | 3 +- pkg/util/exec/exec_test.go | 1 - test/e2e/e2e_suite_test.go | 1 - test/e2e/getenvoy_extension_build_test.go | 1 - test/e2e/getenvoy_extension_examples_test.go | 1 - test/e2e/getenvoy_extension_init_test.go | 1 - test/e2e/getenvoy_extension_push_test.go | 1 - test/e2e/getenvoy_extension_run_test.go | 5 +- test/e2e/getenvoy_extension_test_test.go | 1 - 124 files changed, 221 insertions(+), 327 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 cef66555..6d74cbf7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,18 +32,16 @@ jobs: GOMAXPROCS: "3" steps: - checkout - - run: make init - - run: ./ci/install-lint - - run: ./ci/lint - + - run: make lint + test: executor: builder resource_class: medium+ steps: - checkout - run: make init - - run: ./ci/install-envoy - - run: ./ci/test + - 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)" command: make coverage GO_COVERAGE_EXTRA_OPTS="-p 1" diff --git a/.gitignore b/.gitignore index c2bf0c91..fed09c6c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ vendor dist /getenvoy /build/ +.idea # code generated by `github.com/rakyll/statik` statik.go diff --git a/.golangci.yml b/.golangci.yml index 9df94a7f..f6493cb2 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -34,9 +34,9 @@ run: modules-download-mode: readonly linters: - enable: + enable: - "bodyclose" - # - "depguard" broken in golangci-lint 1.17.1 + - "depguard" - "dupl" - "goconst" - "gocritic" @@ -46,17 +46,15 @@ linters: - "golint" - "gosec" - "gosimple" - - "interfacer" - "lll" - - "maligned" - "misspell" - "nakedret" - "prealloc" - "scopelint" - "unconvert" - "unparam" - - disable: + + disable: - "gochecknoinits" - "gochecknoglobals" @@ -93,67 +91,30 @@ linters-settings: unparam: check-exported: false gocritic: - enabled-checks: - - appendCombine - - appendAssign - - assignOp - - argOrder - - badCond + enabled-checks: # non-default checks we decided to also add - boolExprSimplify - builtinShadow - - captLocal - - caseOrder - - codegenComment - commentedOutCode - commentedOutImport - - defaultCaseOrder - - deprecatedComment - docStub - - dupArg - - dupBranchBody - - dupCase - - dupSubExpr - - elseif - emptyFallthrough - - equalFold - - flagDeref - - flagName - hexLiteral - - indexAlloc - initClause - methodExprCall - nilValReturn - octalLiteral - - offBy1 - - rangeExprCopy - - regexpMust - - singleCaseSwitch - - sloppyLen - - stringXbytes - - switchTrue - typeAssertChain - - typeSwitchVar - typeUnparen - - underef - - unlambda - unnecessaryBlock - - unslice - - valSwap - weakCond - yodaStyleExpr - - commentFormatting - emptyStringTest - - exitAfterDefer - - ifElseChain - - hugeParam - importShadow - nestingReduce - paramTypeCombine - ptrToRefParam - - rangeValCopy - sloppyReassign - unlabelStmt - - wrapperFunc # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks. # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags". @@ -180,7 +141,6 @@ issues: - errcheck - dupl - gosec - - maligned # Exclude lll issues for long lines with go:generate - linters: 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..0bf3d91c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ 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. +- The code is linted using a relatively stringent [golang-ci config](./.golangci.yml). To run this linter (and a few others) use run `make format`. To verify, you can run `make lint`. - 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. ## DCO diff --git a/Makefile b/Makefile index 4674cc0e..eed90d5c 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,32 @@ $(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/tetrateio/getenvoy $$f; \ + done + +.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 960ca58f..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.18.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/config.go b/pkg/binary/envoy/config.go index f9268b71..55222ef6 100644 --- a/pkg/binary/envoy/config.go +++ b/pkg/binary/envoy/config.go @@ -97,7 +97,7 @@ func (r *Runtime) SaveConfig(name, config string) (string, error) { return "", fmt.Errorf("Unable to create directory %q: %v", configDir, err) } filename := name + ".yaml" - err := ioutil.WriteFile(filepath.Join(configDir, filename), []byte(config), 0644) + err := ioutil.WriteFile(filepath.Join(configDir, filename), []byte(config), 0600) if err != nil { return "", fmt.Errorf("Cannot save config file %s: %s", filepath.Join(configDir, filename), err) } diff --git a/pkg/binary/envoy/controlplane/istio.go b/pkg/binary/envoy/controlplane/istio.go index 02548f19..796c7397 100644 --- a/pkg/binary/envoy/controlplane/istio.go +++ b/pkg/binary/envoy/controlplane/istio.go @@ -24,12 +24,10 @@ 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" diff --git a/pkg/binary/envoy/controlplane/istio.tmpl.go b/pkg/binary/envoy/controlplane/istio.tmpl.go index 703b4600..85cf8fc9 100644 --- a/pkg/binary/envoy/controlplane/istio.tmpl.go +++ b/pkg/binary/envoy/controlplane/istio.tmpl.go @@ -28,7 +28,7 @@ func writeIstioTemplate(path string) error { if err := os.MkdirAll(filepath.Dir(path), os.ModePerm); err != nil { return err } - return ioutil.WriteFile(path, []byte(istioBootStrapTemplate), 0644) + return ioutil.WriteFile(path, []byte(istioBootStrapTemplate), 0600) } var istioBootStrapTemplate = `{ diff --git a/pkg/binary/envoy/debug/admin.go b/pkg/binary/envoy/debug/admin.go index 83e024a0..ad8e3807 100644 --- a/pkg/binary/envoy/debug/admin.go +++ b/pkg/binary/envoy/debug/admin.go @@ -22,12 +22,10 @@ import ( "os" "path/filepath" - "github.com/tetratelabs/log" - - "github.com/tetratelabs/multierror" - "github.com/tetratelabs/getenvoy/pkg/binary" "github.com/tetratelabs/getenvoy/pkg/binary/envoy" + "github.com/tetratelabs/log" + "github.com/tetratelabs/multierror" ) var adminAPIPaths = map[string]string{ @@ -68,6 +66,7 @@ func retrieveAdminAPIData(r binary.Runner) error { multiErr = multierror.Append(multiErr, fmt.Errorf("received %v from /%v ", resp.StatusCode, path)) continue } + // #nosec -> r.DebugStore() is allowed to be anywhere f, err := os.OpenFile(filepath.Join(r.DebugStore(), file), os.O_CREATE|os.O_WRONLY, 0600) if err != nil { multiErr = multierror.Append(multiErr, err) diff --git a/pkg/binary/envoy/debug/lsof.go b/pkg/binary/envoy/debug/lsof.go index 36b8ab9c..3af4d7b6 100644 --- a/pkg/binary/envoy/debug/lsof.go +++ b/pkg/binary/envoy/debug/lsof.go @@ -22,7 +22,6 @@ import ( "syscall" "github.com/shirou/gopsutil/process" - "github.com/tetratelabs/getenvoy/pkg/binary" "github.com/tetratelabs/getenvoy/pkg/binary/envoy" "github.com/tetratelabs/log" diff --git a/pkg/binary/envoy/fetch.go b/pkg/binary/envoy/fetch.go index fc10cf47..78d393d7 100644 --- a/pkg/binary/envoy/fetch.go +++ b/pkg/binary/envoy/fetch.go @@ -17,18 +17,14 @@ 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/getenvoy/pkg/manifest" @@ -112,7 +108,7 @@ func fetchEnvoy(dst, src string) error { } func doDownload(dst, src string) (string, error) { - // #nosec -> src destination can be anywhere by design + // #nosec -> src can be anywhere by design resp, err := transport.Get(src) if err != nil { return "", err @@ -124,6 +120,7 @@ func doDownload(dst, src string) (string, error) { } tarball := filepath.Join(dst, "envoy.tar"+filepath.Ext(src)) + // #nosec -> dst can be anywhere by design f, err := os.OpenFile(tarball, os.O_CREATE|os.O_WRONLY, 0600) if err != nil { return "", err diff --git a/pkg/binary/envoy/fetch_test.go b/pkg/binary/envoy/fetch_test.go index ca338812..05d8b86d 100644 --- a/pkg/binary/envoy/fetch_test.go +++ b/pkg/binary/envoy/fetch_test.go @@ -18,11 +18,10 @@ 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/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/cmd/extension/build/cmd.go b/pkg/cmd/extension/build/cmd.go index bf5fd1c8..049a1674 100644 --- a/pkg/cmd/extension/build/cmd.go +++ b/pkg/cmd/extension/build/cmd.go @@ -16,9 +16,7 @@ package build // nolint:dupl import ( "github.com/pkg/errors" - "github.com/spf13/cobra" - "github.com/tetratelabs/getenvoy/pkg/cmd/extension/common" workspaces "github.com/tetratelabs/getenvoy/pkg/extension/workspace" builtinconfig "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/toolchain/builtin" diff --git a/pkg/cmd/extension/build/cmd_test.go b/pkg/cmd/extension/build/cmd_test.go index 74baf00f..20ce5479 100644 --- a/pkg/cmd/extension/build/cmd_test.go +++ b/pkg/cmd/extension/build/cmd_test.go @@ -24,11 +24,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "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..688991c9 100644 --- a/pkg/cmd/extension/clean/cmd.go +++ b/pkg/cmd/extension/clean/cmd.go @@ -16,9 +16,7 @@ package clean // nolint:dupl import ( "github.com/pkg/errors" - "github.com/spf13/cobra" - "github.com/tetratelabs/getenvoy/pkg/cmd/extension/common" workspaces "github.com/tetratelabs/getenvoy/pkg/extension/workspace" builtinconfig "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/toolchain/builtin" diff --git a/pkg/cmd/extension/clean/cmd_test.go b/pkg/cmd/extension/clean/cmd_test.go index dbfcf113..fdc9bb48 100644 --- a/pkg/cmd/extension/clean/cmd_test.go +++ b/pkg/cmd/extension/clean/cmd_test.go @@ -24,11 +24,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "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..3232a73b 100644 --- a/pkg/cmd/extension/common/toolchain.go +++ b/pkg/cmd/extension/common/toolchain.go @@ -15,11 +15,9 @@ 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.go b/pkg/cmd/extension/example/cmd_add.go index 23468d09..d8f2d7ba 100644 --- a/pkg/cmd/extension/example/cmd_add.go +++ b/pkg/cmd/extension/example/cmd_add.go @@ -17,7 +17,6 @@ package example import ( "github.com/pkg/errors" "github.com/spf13/cobra" - workspaces "github.com/tetratelabs/getenvoy/pkg/extension/workspace" examples "github.com/tetratelabs/getenvoy/pkg/extension/workspace/example" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/model" diff --git a/pkg/cmd/extension/example/cmd_add_test.go b/pkg/cmd/extension/example/cmd_add_test.go index 02fd70b6..85eb3ed4 100644 --- a/pkg/cmd/extension/example/cmd_add_test.go +++ b/pkg/cmd/extension/example/cmd_add_test.go @@ -24,11 +24,8 @@ 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.go b/pkg/cmd/extension/example/cmd_list.go index 03db8490..cb04b7ef 100644 --- a/pkg/cmd/extension/example/cmd_list.go +++ b/pkg/cmd/extension/example/cmd_list.go @@ -19,7 +19,6 @@ import ( "text/tabwriter" "github.com/spf13/cobra" - workspaces "github.com/tetratelabs/getenvoy/pkg/extension/workspace" ) diff --git a/pkg/cmd/extension/example/cmd_list_test.go b/pkg/cmd/extension/example/cmd_list_test.go index 7268e791..b3c965d6 100644 --- a/pkg/cmd/extension/example/cmd_list_test.go +++ b/pkg/cmd/extension/example/cmd_list_test.go @@ -22,11 +22,8 @@ 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.go b/pkg/cmd/extension/example/cmd_remove.go index 7ca0a28d..a1c59159 100644 --- a/pkg/cmd/extension/example/cmd_remove.go +++ b/pkg/cmd/extension/example/cmd_remove.go @@ -18,7 +18,6 @@ import ( "fmt" "github.com/spf13/cobra" - workspaces "github.com/tetratelabs/getenvoy/pkg/extension/workspace" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/model" ) diff --git a/pkg/cmd/extension/example/cmd_remove_test.go b/pkg/cmd/extension/example/cmd_remove_test.go index 873e86a5..d8c1b128 100644 --- a/pkg/cmd/extension/example/cmd_remove_test.go +++ b/pkg/cmd/extension/example/cmd_remove_test.go @@ -24,11 +24,8 @@ 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/feedback.go b/pkg/cmd/extension/example/feedback.go index 5224f2a2..5d647e4c 100644 --- a/pkg/cmd/extension/example/feedback.go +++ b/pkg/cmd/extension/example/feedback.go @@ -19,7 +19,6 @@ import ( "io" "github.com/spf13/cobra" - scaffoldutil "github.com/tetratelabs/getenvoy/pkg/util/scaffold" uiutil "github.com/tetratelabs/getenvoy/pkg/util/ui" ) diff --git a/pkg/cmd/extension/init/cmd.go b/pkg/cmd/extension/init/cmd.go index 0b617b8c..e8c957d1 100644 --- a/pkg/cmd/extension/init/cmd.go +++ b/pkg/cmd/extension/init/cmd.go @@ -19,7 +19,6 @@ import ( "strings" "github.com/spf13/cobra" - "github.com/tetratelabs/getenvoy/pkg/cmd/extension/globals" scaffold "github.com/tetratelabs/getenvoy/pkg/extension/init" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" diff --git a/pkg/cmd/extension/init/cmd_test.go b/pkg/cmd/extension/init/cmd_test.go index 7ceb39e8..79b1925e 100644 --- a/pkg/cmd/extension/init/cmd_test.go +++ b/pkg/cmd/extension/init/cmd_test.go @@ -23,9 +23,7 @@ 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" workspaces "github.com/tetratelabs/getenvoy/pkg/extension/workspace" cmdutil "github.com/tetratelabs/getenvoy/pkg/util/cmd" diff --git a/pkg/cmd/extension/init/feedback_test.go b/pkg/cmd/extension/init/feedback_test.go index c9996852..da2dc24a 100644 --- a/pkg/cmd/extension/init/feedback_test.go +++ b/pkg/cmd/extension/init/feedback_test.go @@ -20,9 +20,7 @@ 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" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" uiutil "github.com/tetratelabs/getenvoy/pkg/util/ui" diff --git a/pkg/cmd/extension/init/params.go b/pkg/cmd/extension/init/params.go index fc1de866..4803d0fc 100644 --- a/pkg/cmd/extension/init/params.go +++ b/pkg/cmd/extension/init/params.go @@ -19,10 +19,8 @@ import ( "path/filepath" "github.com/pkg/errors" - 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.go b/pkg/cmd/extension/init/wizard.go index 90caba91..473073d2 100644 --- a/pkg/cmd/extension/init/wizard.go +++ b/pkg/cmd/extension/init/wizard.go @@ -18,7 +18,6 @@ import ( "fmt" "github.com/manifoldco/promptui" - uiutil "github.com/tetratelabs/getenvoy/pkg/util/ui" ) diff --git a/pkg/cmd/extension/init/wizard_test.go b/pkg/cmd/extension/init/wizard_test.go index f4a5b843..6164d8ba 100644 --- a/pkg/cmd/extension/init/wizard_test.go +++ b/pkg/cmd/extension/init/wizard_test.go @@ -23,9 +23,7 @@ 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/push/cmd.go b/pkg/cmd/extension/push/cmd.go index cdd77fa7..12b8d53e 100644 --- a/pkg/cmd/extension/push/cmd.go +++ b/pkg/cmd/extension/push/cmd.go @@ -20,7 +20,6 @@ import ( "github.com/docker/distribution/reference" "github.com/spf13/cobra" - "github.com/tetratelabs/getenvoy/pkg/cmd/extension/common" "github.com/tetratelabs/getenvoy/pkg/extension/wasmimage" workspaces "github.com/tetratelabs/getenvoy/pkg/extension/workspace" diff --git a/pkg/cmd/extension/push/cmd_test.go b/pkg/cmd/extension/push/cmd_test.go index 929215fa..878a550a 100644 --- a/pkg/cmd/extension/push/cmd_test.go +++ b/pkg/cmd/extension/push/cmd_test.go @@ -23,7 +23,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "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/root.go b/pkg/cmd/extension/root.go index f0bf5d62..a7c57112 100644 --- a/pkg/cmd/extension/root.go +++ b/pkg/cmd/extension/root.go @@ -19,7 +19,6 @@ import ( "github.com/mattn/go-isatty" "github.com/spf13/cobra" - "github.com/tetratelabs/getenvoy/pkg/cmd/extension/build" "github.com/tetratelabs/getenvoy/pkg/cmd/extension/clean" "github.com/tetratelabs/getenvoy/pkg/cmd/extension/example" diff --git a/pkg/cmd/extension/root_test.go b/pkg/cmd/extension/root_test.go index 316636d0..1398ab1c 100644 --- a/pkg/cmd/extension/root_test.go +++ b/pkg/cmd/extension/root_test.go @@ -21,10 +21,8 @@ import ( . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" "github.com/spf13/cobra" - "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/run/cmd.go b/pkg/cmd/extension/run/cmd.go index 6d6da716..a1c9e6a3 100644 --- a/pkg/cmd/extension/run/cmd.go +++ b/pkg/cmd/extension/run/cmd.go @@ -19,7 +19,6 @@ import ( "github.com/pkg/errors" "github.com/spf13/cobra" - "github.com/tetratelabs/getenvoy/pkg/cmd/extension/build" "github.com/tetratelabs/getenvoy/pkg/cmd/extension/common" examplecmd "github.com/tetratelabs/getenvoy/pkg/cmd/extension/example" diff --git a/pkg/cmd/extension/run/cmd_test.go b/pkg/cmd/extension/run/cmd_test.go index 62906a17..479b1e22 100644 --- a/pkg/cmd/extension/run/cmd_test.go +++ b/pkg/cmd/extension/run/cmd_test.go @@ -30,7 +30,6 @@ import ( "github.com/otiai10/copy" "github.com/pkg/errors" "github.com/spf13/cobra" - "github.com/tetratelabs/getenvoy/pkg/cmd" "github.com/tetratelabs/getenvoy/pkg/manifest" testcontext "github.com/tetratelabs/getenvoy/pkg/test/cmd/extension" @@ -356,7 +355,7 @@ Run 'getenvoy extension run --help' for usage. By("creating a non-executable file") filePath := filepath.Join(tempDir, "envoy") - err = ioutil.WriteFile(filePath, []byte(`#!/bin/sh`), 0644) + err = ioutil.WriteFile(filePath, []byte(`#!/bin/sh`), 0600) Expect(err).NotTo(HaveOccurred()) By("running command") @@ -616,7 +615,7 @@ Run 'getenvoy extension run --help' for usage. Expect(os.RemoveAll(tempDir)).To(Succeed()) }() wasmFile := filepath.Join(tempDir, "extension.wasm") - err = ioutil.WriteFile(wasmFile, []byte{}, 0644) + err = ioutil.WriteFile(wasmFile, []byte{}, 0600) Expect(err).NotTo(HaveOccurred()) By("running command") @@ -648,7 +647,7 @@ Run 'getenvoy extension run --help' for usage. Expect(os.RemoveAll(tempDir)).To(Succeed()) }() configFile := filepath.Join(tempDir, "config.json") - err = ioutil.WriteFile(configFile, []byte(`{"key2":"value2"}`), 0644) + err = ioutil.WriteFile(configFile, []byte(`{"key2":"value2"}`), 0600) Expect(err).NotTo(HaveOccurred()) By("running command") diff --git a/pkg/cmd/extension/test/cmd.go b/pkg/cmd/extension/test/cmd.go index 53ab0ca7..069103ed 100644 --- a/pkg/cmd/extension/test/cmd.go +++ b/pkg/cmd/extension/test/cmd.go @@ -16,9 +16,7 @@ package test // nolint:dupl import ( "github.com/pkg/errors" - "github.com/spf13/cobra" - "github.com/tetratelabs/getenvoy/pkg/cmd/extension/common" workspaces "github.com/tetratelabs/getenvoy/pkg/extension/workspace" builtinconfig "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/toolchain/builtin" diff --git a/pkg/cmd/extension/test/cmd_test.go b/pkg/cmd/extension/test/cmd_test.go index ead5abe4..07211537 100644 --- a/pkg/cmd/extension/test/cmd_test.go +++ b/pkg/cmd/extension/test/cmd_test.go @@ -24,11 +24,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "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/root.go b/pkg/cmd/root.go index be1d4ce7..bde56354 100644 --- a/pkg/cmd/root.go +++ b/pkg/cmd/root.go @@ -18,18 +18,14 @@ import ( "os" "strconv" - "github.com/tetratelabs/log" - "github.com/pkg/errors" - "github.com/spf13/cobra" - "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" + "github.com/tetratelabs/log" ) // 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..fe0a49d4 100644 --- a/pkg/cmd/root_test.go +++ b/pkg/cmd/root_test.go @@ -21,17 +21,13 @@ 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..230bc761 100644 --- a/pkg/cmd/run.go +++ b/pkg/cmd/run.go @@ -23,12 +23,10 @@ import ( "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/example/init/registry/types.go b/pkg/extension/example/init/registry/types.go index 45ba1880..94381d75 100644 --- a/pkg/extension/example/init/registry/types.go +++ b/pkg/extension/example/init/registry/types.go @@ -24,7 +24,6 @@ import ( "github.com/pkg/errors" "github.com/shurcooL/httpfs/vfsutil" - "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/model" ) diff --git a/pkg/extension/init/descriptor.go b/pkg/extension/init/descriptor.go index 31ce14d3..23e27d42 100644 --- a/pkg/extension/init/descriptor.go +++ b/pkg/extension/init/descriptor.go @@ -19,7 +19,6 @@ import ( "strings" "github.com/pkg/errors" - "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" ) diff --git a/pkg/extension/init/descriptor_test.go b/pkg/extension/init/descriptor_test.go index 3d5fead0..f0bd2b8e 100644 --- a/pkg/extension/init/descriptor_test.go +++ b/pkg/extension/init/descriptor_test.go @@ -18,9 +18,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "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..0a40326c 100644 --- a/pkg/extension/init/init.go +++ b/pkg/extension/init/init.go @@ -26,12 +26,10 @@ import ( "text/template" "github.com/pkg/errors" - "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" + "github.com/tetratelabs/multierror" ) // ScaffoldOpts represents configuration options supported by Scaffold(). diff --git a/pkg/extension/init/init_test.go b/pkg/extension/init/init_test.go index dbcf71bf..929e4aea 100644 --- a/pkg/extension/init/init_test.go +++ b/pkg/extension/init/init_test.go @@ -22,7 +22,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" - "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" ) diff --git a/pkg/extension/init/source.go b/pkg/extension/init/source.go index 054a6cfb..d5c025ed 100644 --- a/pkg/extension/init/source.go +++ b/pkg/extension/init/source.go @@ -21,7 +21,6 @@ import ( "sync" "github.com/rakyll/statik/fs" - "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" // force execution of auto generated code diff --git a/pkg/extension/init/sources.go b/pkg/extension/init/sources.go index 33f2e939..1cf2aa73 100644 --- a/pkg/extension/init/sources.go +++ b/pkg/extension/init/sources.go @@ -18,9 +18,8 @@ import ( "fmt" "net/http" - "github.com/tetratelabs/multierror" - "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" + "github.com/tetratelabs/multierror" ) // templateSource represents a source of extension templates. diff --git a/pkg/extension/init/workspace.go b/pkg/extension/init/workspace.go index b9e0ec3f..94979661 100644 --- a/pkg/extension/init/workspace.go +++ b/pkg/extension/init/workspace.go @@ -19,7 +19,6 @@ import ( "html/template" "github.com/pkg/errors" - "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/fs" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/model" diff --git a/pkg/extension/wasmimage/puller.go b/pkg/extension/wasmimage/puller.go index 97d85c35..c3aa11fc 100644 --- a/pkg/extension/wasmimage/puller.go +++ b/pkg/extension/wasmimage/puller.go @@ -40,8 +40,8 @@ func NewPuller(insecure, useHTTP bool) (*Puller, error) { client.Transport = &http.Transport{ TLSClientConfig: &tls.Config{ - // nolint:gosec this option is only enabled when the user specify the insecure flag. - InsecureSkipVerify: insecure, + // this option is only enabled when the user specify the insecure flag. + InsecureSkipVerify: insecure, // nolint:gosec }, } @@ -77,7 +77,7 @@ func (p *Puller) Pull(imageRef, imagePath string) (ocispec.Descriptor, error) { } manifest, image, _ := store.Get(layers[0]) - if err := ioutil.WriteFile(imagePath, image, 0755); err != nil { + if err := ioutil.WriteFile(imagePath, image, 0600); err != nil { return manifest, fmt.Errorf("failed to write image: %w", err) } diff --git a/pkg/extension/wasmimage/pusher.go b/pkg/extension/wasmimage/pusher.go index 99e22680..db9e34cd 100644 --- a/pkg/extension/wasmimage/pusher.go +++ b/pkg/extension/wasmimage/pusher.go @@ -39,8 +39,8 @@ func NewPusher(insecure, useHTTP bool) (*Pusher, error) { if insecure { client.Transport = &http.Transport{ TLSClientConfig: &tls.Config{ - // nolint:gosec this option is only enabled when the user specify the insecure flag. - InsecureSkipVerify: true, + // this option is only enabled when the user specify the insecure flag. + InsecureSkipVerify: true, // nolint:gosec }, } } diff --git a/pkg/extension/workspace/config/example/helpers.go b/pkg/extension/workspace/config/example/helpers.go index 962f5c32..347db625 100644 --- a/pkg/extension/workspace/config/example/helpers.go +++ b/pkg/extension/workspace/config/example/helpers.go @@ -16,10 +16,9 @@ package example import ( "github.com/pkg/errors" - "github.com/tetratelabs/multierror" - "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config" "github.com/tetratelabs/getenvoy/pkg/types" + "github.com/tetratelabs/multierror" ) // NewExampleDescriptor returns a new example descriptor instance. diff --git a/pkg/extension/workspace/config/extension/extension_test.go b/pkg/extension/workspace/config/extension/extension_test.go index de633d85..ee1d1965 100644 --- a/pkg/extension/workspace/config/extension/extension_test.go +++ b/pkg/extension/workspace/config/extension/extension_test.go @@ -20,10 +20,8 @@ import ( . "github.com/onsi/ginkgo" . "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/extension/helpers.go b/pkg/extension/workspace/config/extension/helpers.go index 64b75a0f..0b74d4ae 100644 --- a/pkg/extension/workspace/config/extension/helpers.go +++ b/pkg/extension/workspace/config/extension/helpers.go @@ -20,10 +20,9 @@ import ( "strings" "github.com/pkg/errors" - "github.com/tetratelabs/multierror" - "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config" "github.com/tetratelabs/getenvoy/pkg/types" + "github.com/tetratelabs/multierror" ) // NewExtensionDescriptor returns a new extension descriptor instance. diff --git a/pkg/extension/workspace/config/toolchain/builtin/helpers.go b/pkg/extension/workspace/config/toolchain/builtin/helpers.go index 8811ed46..e2d99dfb 100644 --- a/pkg/extension/workspace/config/toolchain/builtin/helpers.go +++ b/pkg/extension/workspace/config/toolchain/builtin/helpers.go @@ -17,11 +17,10 @@ package builtin import ( "path" - "github.com/pkg/errors" - "github.com/tetratelabs/multierror" - "github.com/docker/distribution/reference" + "github.com/pkg/errors" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config" + "github.com/tetratelabs/multierror" ) // NewToolchainConfig returns a new built-in toolchain 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..ba2c1582 100644 --- a/pkg/extension/workspace/config/toolchain/builtin/helpers_test.go +++ b/pkg/extension/workspace/config/toolchain/builtin/helpers_test.go @@ -18,9 +18,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "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.go b/pkg/extension/workspace/example/envoy/template/expand.go index e11e28c8..744104d9 100644 --- a/pkg/extension/workspace/example/envoy/template/expand.go +++ b/pkg/extension/workspace/example/envoy/template/expand.go @@ -19,7 +19,6 @@ import ( "text/template" "github.com/pkg/errors" - "github.com/tetratelabs/getenvoy/pkg/extension/manager" ) diff --git a/pkg/extension/workspace/example/envoy/template/expand_test.go b/pkg/extension/workspace/example/envoy/template/expand_test.go index cc832303..cd6ec673 100644 --- a/pkg/extension/workspace/example/envoy/template/expand_test.go +++ b/pkg/extension/workspace/example/envoy/template/expand_test.go @@ -18,11 +18,9 @@ import ( . "github.com/onsi/ginkgo" . "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..7fa2e410 100644 --- a/pkg/extension/workspace/example/envoy/util/load.go +++ b/pkg/extension/workspace/example/envoy/util/load.go @@ -17,15 +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..25cee428 100644 --- a/pkg/extension/workspace/example/envoy/util/load_test.go +++ b/pkg/extension/workspace/example/envoy/util/load_test.go @@ -18,14 +18,11 @@ 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/lookup.go b/pkg/extension/workspace/example/lookup.go index ef7ff1c0..a1e378a4 100644 --- a/pkg/extension/workspace/example/lookup.go +++ b/pkg/extension/workspace/example/lookup.go @@ -16,7 +16,6 @@ package example import ( "github.com/pkg/errors" - "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 3101eb15..2e5ffaba 100644 --- a/pkg/extension/workspace/example/runtime/configdir/configdir.go +++ b/pkg/extension/workspace/example/runtime/configdir/configdir.go @@ -22,7 +22,6 @@ import ( envoybootstrap "github.com/envoyproxy/go-control-plane/envoy/config/bootstrap/v3" "github.com/pkg/errors" - "github.com/tetratelabs/getenvoy/pkg/extension/manager" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/example/envoy/template" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/example/envoy/util" @@ -194,7 +193,7 @@ func (d *configDir) writeFile(fileName string, data []byte) error { if err := osutil.EnsureDirExists(filepath.Dir(outputFile)); err != nil { return err } - if err := ioutil.WriteFile(outputFile, data, 0644); err != nil { + if err := ioutil.WriteFile(outputFile, data, 0600); err != nil { return errors.Wrapf(err, "failed to write config file to %q", outputFile) } return nil diff --git a/pkg/extension/workspace/example/runtime/configdir/configdir_test.go b/pkg/extension/workspace/example/runtime/configdir/configdir_test.go index e6d49df3..681c663f 100644 --- a/pkg/extension/workspace/example/runtime/configdir/configdir_test.go +++ b/pkg/extension/workspace/example/runtime/configdir/configdir_test.go @@ -24,7 +24,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" - 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/configdir" diff --git a/pkg/extension/workspace/example/runtime/getenvoy/runtime.go b/pkg/extension/workspace/example/runtime/getenvoy/runtime.go index e0a43c27..2b3ff140 100644 --- a/pkg/extension/workspace/example/runtime/getenvoy/runtime.go +++ b/pkg/extension/workspace/example/runtime/getenvoy/runtime.go @@ -15,14 +15,12 @@ package getenvoy import ( - "github.com/tetratelabs/multierror" - "github.com/tetratelabs/getenvoy/pkg/binary/envoy" "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" + "github.com/tetratelabs/multierror" ) // NewRuntime returns a new runtime backed by GetEnvoy. diff --git a/pkg/extension/workspace/example/runtime/getenvoy/runtime_test.go b/pkg/extension/workspace/example/runtime/getenvoy/runtime_test.go index f884cfad..80728f3e 100644 --- a/pkg/extension/workspace/example/runtime/getenvoy/runtime_test.go +++ b/pkg/extension/workspace/example/runtime/getenvoy/runtime_test.go @@ -24,14 +24,11 @@ import ( . "github.com/onsi/ginkgo" . "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..61dfa763 100644 --- a/pkg/extension/workspace/example/scaffold.go +++ b/pkg/extension/workspace/example/scaffold.go @@ -16,10 +16,8 @@ package example import ( "github.com/pkg/errors" - "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/fs/lookup.go b/pkg/extension/workspace/fs/lookup.go index a899fa09..5c208520 100644 --- a/pkg/extension/workspace/fs/lookup.go +++ b/pkg/extension/workspace/fs/lookup.go @@ -19,7 +19,6 @@ import ( "path/filepath" "github.com/pkg/errors" - osutil "github.com/tetratelabs/getenvoy/pkg/util/os" ) diff --git a/pkg/extension/workspace/fs/types.go b/pkg/extension/workspace/fs/types.go index d6a2ff2b..b86caded 100644 --- a/pkg/extension/workspace/fs/types.go +++ b/pkg/extension/workspace/fs/types.go @@ -20,7 +20,6 @@ import ( "path/filepath" "github.com/pkg/errors" - osutil "github.com/tetratelabs/getenvoy/pkg/util/os" ) @@ -57,7 +56,7 @@ func (d workspaceDir) WriteFile(path string, data []byte) error { if err := osutil.EnsureDirExists(filepath.Dir(path)); err != nil { return err } - return ioutil.WriteFile(path, data, 0644) + return ioutil.WriteFile(path, data, 0600) } func (d workspaceDir) HasDir(path string) (bool, error) { diff --git a/pkg/extension/workspace/model/example.go b/pkg/extension/workspace/model/example.go index 47698263..a61cfd40 100644 --- a/pkg/extension/workspace/model/example.go +++ b/pkg/extension/workspace/model/example.go @@ -16,7 +16,6 @@ package model import ( "github.com/pkg/errors" - "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config" exampleconfig "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/example" ) 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/toolchain/builtin/default_config.go b/pkg/extension/workspace/toolchain/builtin/default_config.go index 65a67ffd..3ee88673 100644 --- a/pkg/extension/workspace/toolchain/builtin/default_config.go +++ b/pkg/extension/workspace/toolchain/builtin/default_config.go @@ -16,7 +16,6 @@ package builtin import ( "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" dockerutil "github.com/tetratelabs/getenvoy/pkg/util/docker" diff --git a/pkg/extension/workspace/toolchain/builtin/default_config_test.go b/pkg/extension/workspace/toolchain/builtin/default_config_test.go index 3ce88c65..a0545a50 100644 --- a/pkg/extension/workspace/toolchain/builtin/default_config_test.go +++ b/pkg/extension/workspace/toolchain/builtin/default_config_test.go @@ -22,7 +22,6 @@ import ( . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" "github.com/pkg/errors" - "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" ) diff --git a/pkg/extension/workspace/toolchain/builtin/example_config_test.go b/pkg/extension/workspace/toolchain/builtin/example_config_test.go index c5c9d7d7..08e1d6b7 100644 --- a/pkg/extension/workspace/toolchain/builtin/example_config_test.go +++ b/pkg/extension/workspace/toolchain/builtin/example_config_test.go @@ -22,7 +22,6 @@ import ( . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" "github.com/pkg/errors" - "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" . "github.com/tetratelabs/getenvoy/pkg/extension/workspace/toolchain/builtin" ) diff --git a/pkg/extension/workspace/toolchain/builtin/factory_test.go b/pkg/extension/workspace/toolchain/builtin/factory_test.go index 26e455b0..93c1537b 100644 --- a/pkg/extension/workspace/toolchain/builtin/factory_test.go +++ b/pkg/extension/workspace/toolchain/builtin/factory_test.go @@ -18,14 +18,12 @@ import ( . "github.com/onsi/ginkgo" . "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..31c16998 100644 --- a/pkg/extension/workspace/toolchain/builtin/toolchain_test.go +++ b/pkg/extension/workspace/toolchain/builtin/toolchain_test.go @@ -27,13 +27,11 @@ import ( . "github.com/onsi/ginkgo" . "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/extension/workspace/toolchain/lookup.go b/pkg/extension/workspace/toolchain/lookup.go index f040d42c..a20ff244 100644 --- a/pkg/extension/workspace/toolchain/lookup.go +++ b/pkg/extension/workspace/toolchain/lookup.go @@ -16,7 +16,6 @@ package toolchain import ( "github.com/pkg/errors" - "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/model" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/toolchain/builtin" diff --git a/pkg/extension/workspace/toolchain/lookup_test.go b/pkg/extension/workspace/toolchain/lookup_test.go index 09eb4a78..265441ba 100644 --- a/pkg/extension/workspace/toolchain/lookup_test.go +++ b/pkg/extension/workspace/toolchain/lookup_test.go @@ -21,7 +21,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - workspaces "github.com/tetratelabs/getenvoy/pkg/extension/workspace" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/fs" "github.com/tetratelabs/getenvoy/pkg/extension/workspace/model" diff --git a/pkg/manifest/locate.go b/pkg/manifest/locate.go index 6298cdf2..fbd585ca 100644 --- a/pkg/manifest/locate.go +++ b/pkg/manifest/locate.go @@ -21,7 +21,6 @@ import ( "strings" "github.com/pkg/errors" - "github.com/tetratelabs/getenvoy-package/api" "github.com/tetratelabs/getenvoy/pkg/types" "github.com/tetratelabs/log" 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/cmd/extension/context.go b/pkg/test/cmd/extension/context.go index d882c05f..96418d06 100644 --- a/pkg/test/cmd/extension/context.go +++ b/pkg/test/cmd/extension/context.go @@ -18,7 +18,6 @@ import ( "os/user" . "github.com/onsi/ginkgo" //nolint:golint - builtintoolchain "github.com/tetratelabs/getenvoy/pkg/extension/workspace/toolchain/builtin" ) diff --git a/pkg/test/manifest/platform.go b/pkg/test/manifest/platform.go index 769f4ef1..b13ddff2 100644 --- a/pkg/test/manifest/platform.go +++ b/pkg/test/manifest/platform.go @@ -18,7 +18,6 @@ import ( "strings" "github.com/pkg/errors" - "github.com/tetratelabs/getenvoy-package/api" ) diff --git a/pkg/test/manifest/server.go b/pkg/test/manifest/server.go index 00e06c6b..9074b107 100644 --- a/pkg/test/manifest/server.go +++ b/pkg/test/manifest/server.go @@ -23,14 +23,11 @@ import ( "path/filepath" "strings" - "github.com/pkg/errors" - "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" - - "github.com/tetratelabs/getenvoy-package/api" - "github.com/mholt/archiver" + "github.com/pkg/errors" + "github.com/tetratelabs/getenvoy-package/api" ) const ( diff --git a/pkg/types/types_test.go b/pkg/types/types_test.go index 23e948b6..cd2180ef 100644 --- a/pkg/types/types_test.go +++ b/pkg/types/types_test.go @@ -18,7 +18,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" - . "github.com/tetratelabs/getenvoy/pkg/types" ) 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/args/args_test.go b/pkg/util/args/args_test.go index 5246c4e1..02a799eb 100644 --- a/pkg/util/args/args_test.go +++ b/pkg/util/args/args_test.go @@ -18,7 +18,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" - . "github.com/tetratelabs/getenvoy/pkg/util/args" ) diff --git a/pkg/util/cmd/cmd.go b/pkg/util/cmd/cmd.go index 5e7ebddd..c7ed9b11 100644 --- a/pkg/util/cmd/cmd.go +++ b/pkg/util/cmd/cmd.go @@ -16,7 +16,6 @@ package cmd import ( "github.com/spf13/cobra" - cmderrors "github.com/tetratelabs/getenvoy/pkg/util/cmd/errors" ) diff --git a/pkg/util/cmd/cmd_test.go b/pkg/util/cmd/cmd_test.go index 5d89535b..176886bc 100644 --- a/pkg/util/cmd/cmd_test.go +++ b/pkg/util/cmd/cmd_test.go @@ -18,17 +18,13 @@ 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/io.go b/pkg/util/cmd/io.go index 88e5c924..7ce0f84a 100644 --- a/pkg/util/cmd/io.go +++ b/pkg/util/cmd/io.go @@ -16,7 +16,6 @@ package cmd import ( "github.com/spf13/cobra" - ioutil "github.com/tetratelabs/getenvoy/pkg/util/io" ) diff --git a/pkg/util/cmd/run_test.go b/pkg/util/cmd/run_test.go index fc3629f9..a9489432 100644 --- a/pkg/util/cmd/run_test.go +++ b/pkg/util/cmd/run_test.go @@ -17,11 +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/pkg/util/exec/exec.go b/pkg/util/exec/exec.go index 20989264..6c60940a 100644 --- a/pkg/util/exec/exec.go +++ b/pkg/util/exec/exec.go @@ -21,11 +21,10 @@ import ( "syscall" "time" - "github.com/tetratelabs/log" - commonerrors "github.com/tetratelabs/getenvoy/pkg/errors" ioutil "github.com/tetratelabs/getenvoy/pkg/util/io" osutil "github.com/tetratelabs/getenvoy/pkg/util/os" + "github.com/tetratelabs/log" ) var ( diff --git a/pkg/util/exec/exec_test.go b/pkg/util/exec/exec_test.go index 44cd3817..3a6da43d 100644 --- a/pkg/util/exec/exec_test.go +++ b/pkg/util/exec/exec_test.go @@ -27,7 +27,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - commonerrors "github.com/tetratelabs/getenvoy/pkg/errors" ioutil "github.com/tetratelabs/getenvoy/pkg/util/io" ) diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 74d629d2..f67b9308 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -22,7 +22,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - e2e "github.com/tetratelabs/getenvoy/test/e2e/util" ) diff --git a/test/e2e/getenvoy_extension_build_test.go b/test/e2e/getenvoy_extension_build_test.go index f5385789..7477d59d 100644 --- a/test/e2e/getenvoy_extension_build_test.go +++ b/test/e2e/getenvoy_extension_build_test.go @@ -21,7 +21,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" - workspaces "github.com/tetratelabs/getenvoy/pkg/extension/workspace" toolchains "github.com/tetratelabs/getenvoy/pkg/extension/workspace/toolchain" e2e "github.com/tetratelabs/getenvoy/test/e2e/util" diff --git a/test/e2e/getenvoy_extension_examples_test.go b/test/e2e/getenvoy_extension_examples_test.go index e32a9f5b..d802d5f5 100644 --- a/test/e2e/getenvoy_extension_examples_test.go +++ b/test/e2e/getenvoy_extension_examples_test.go @@ -22,7 +22,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" - "github.com/tetratelabs/getenvoy/pkg/extension/workspace/config/extension" e2e "github.com/tetratelabs/getenvoy/test/e2e/util" ) diff --git a/test/e2e/getenvoy_extension_init_test.go b/test/e2e/getenvoy_extension_init_test.go index 0dd4e0f7..3fb4f1de 100644 --- a/test/e2e/getenvoy_extension_init_test.go +++ b/test/e2e/getenvoy_extension_init_test.go @@ -21,7 +21,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" - workspaces "github.com/tetratelabs/getenvoy/pkg/extension/workspace" e2e "github.com/tetratelabs/getenvoy/test/e2e/util" ) diff --git a/test/e2e/getenvoy_extension_push_test.go b/test/e2e/getenvoy_extension_push_test.go index a39ee30a..05e5584c 100644 --- a/test/e2e/getenvoy_extension_push_test.go +++ b/test/e2e/getenvoy_extension_push_test.go @@ -26,7 +26,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" - "github.com/tetratelabs/getenvoy/pkg/common" "github.com/tetratelabs/getenvoy/pkg/extension/wasmimage" workspaces "github.com/tetratelabs/getenvoy/pkg/extension/workspace" diff --git a/test/e2e/getenvoy_extension_run_test.go b/test/e2e/getenvoy_extension_run_test.go index dc93de46..44739b82 100644 --- a/test/e2e/getenvoy_extension_run_test.go +++ b/test/e2e/getenvoy_extension_run_test.go @@ -23,14 +23,11 @@ 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" ) diff --git a/test/e2e/getenvoy_extension_test_test.go b/test/e2e/getenvoy_extension_test_test.go index 9bdc2ea5..70386a28 100644 --- a/test/e2e/getenvoy_extension_test_test.go +++ b/test/e2e/getenvoy_extension_test_test.go @@ -21,7 +21,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" - e2e "github.com/tetratelabs/getenvoy/test/e2e/util" )