Remove vendor directory and enable go modules
This commit is contained in:
parent
14acc186f0
commit
93bf818214
7 changed files with 13 additions and 32 deletions
9
Makefile
9
Makefile
|
@ -65,9 +65,6 @@ BASE_IMAGE ?= quay.io/kubernetes-ingress-controller/nginx:e3c49c52f4b74fe47ad65d
|
|||
|
||||
GOARCH=$(ARCH)
|
||||
|
||||
# use vendor directory instead of go modules https://github.com/golang/go/wiki/Modules
|
||||
GO111MODULE=off
|
||||
|
||||
help: ## Display this help
|
||||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
|
||||
|
||||
|
@ -189,12 +186,6 @@ check_dead_links: ## Check if the documentation contains dead links.
|
|||
--allow-dupe \
|
||||
--allow-redirect $(shell find $$PWD -mindepth 1 -name "*.md" -printf '%P\n' | grep -v vendor | grep -v Changelog.md)
|
||||
|
||||
.PHONY: dep-ensure
|
||||
dep-ensure: check-go-version ## Update and vendo go dependencies.
|
||||
GO111MODULE=on go mod tidy -v
|
||||
find vendor -name '*_test.go' -delete
|
||||
GO111MODULE=on go mod vendor
|
||||
|
||||
.PHONY: dev-env
|
||||
dev-env: check-go-version ## Starts a local Kubernetes cluster using kind, building and deploying the ingress controller.
|
||||
@build/dev-env.sh
|
||||
|
|
|
@ -44,8 +44,6 @@ if [ "$missing" = true ]; then
|
|||
fi
|
||||
|
||||
export CGO_ENABLED=0
|
||||
# use vendor directory instead of go modules https://github.com/golang/go/wiki/Modules
|
||||
export GO111MODULE=off
|
||||
|
||||
release=cmd/plugin/release
|
||||
|
||||
|
|
|
@ -27,11 +27,6 @@ if [ -z "${PKG}" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
export CGO_ENABLED=1
|
||||
export GODEBUG=netdns=cgo+2
|
||||
# use vendor directory instead of go modules https://github.com/golang/go/wiki/Modules
|
||||
export GO111MODULE=off
|
||||
|
||||
rm -rf coverage.txt
|
||||
for d in $(go list "${PKG}/..." | grep -v vendor | grep -v '/test/e2e' | grep -v images); do
|
||||
t=$(date +%s);
|
||||
|
|
|
@ -56,7 +56,6 @@ docker run \
|
|||
--rm \
|
||||
${DOCKER_OPTS} \
|
||||
-e GOCACHE="/go/src/${PKG}/.cache" \
|
||||
-e GO111MODULE=off \
|
||||
-e DIND_TASKS=0 \
|
||||
-v "${HOME}/.kube:${HOME}/.kube" \
|
||||
-v "${KUBE_ROOT}:/go/src/${PKG}" \
|
||||
|
|
|
@ -28,11 +28,5 @@ if [ -z "${PKG}" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# enabled to use host dns resolver
|
||||
export CGO_ENABLED=1
|
||||
export GODEBUG=netdns=cgo+2
|
||||
# use vendor directory instead of go modules https://github.com/golang/go/wiki/Modules
|
||||
export GO111MODULE=off
|
||||
|
||||
go test -v \
|
||||
$(go list "${PKG}/..." | grep -v vendor | grep -v '/test/e2e' | grep -v images | grep -v "docs/examples")
|
||||
|
|
|
@ -18,10 +18,17 @@ set -o errexit
|
|||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
export GO111MODULE=off
|
||||
|
||||
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/..
|
||||
CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)}
|
||||
CODEGEN_VERSION=$(grep 'k8s.io/code-generator' go.sum | awk '{print $2}' | sed 's/\/go.mod//g' | head -1)
|
||||
CODEGEN_PKG=$(echo `go env GOPATH`"/pkg/mod/k8s.io/code-generator@${CODEGEN_VERSION}")
|
||||
|
||||
if [[ ! -d ${CODEGEN_PKG} ]]; then
|
||||
echo "${CODEGEN_PKG} is missing. Running 'go mod download'."
|
||||
go mod download
|
||||
fi
|
||||
|
||||
# Ensure we can execute.
|
||||
chmod +x ${CODEGEN_PKG}/generate-groups.sh
|
||||
|
||||
# generate the code with:
|
||||
# --output-base because this script should also be able to run inside the vendor dir of
|
||||
|
@ -31,11 +38,8 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-
|
|||
# k8s.io/ingress-nginx/pkg/client k8s.io/ingress-nginx/pkg/apis \
|
||||
# nginxingress:v1alpha1 \
|
||||
# --output-base "$(dirname ${BASH_SOURCE})/../../.."
|
||||
mkdir -p ${CODEGEN_PKG}/hack
|
||||
cp ${SCRIPT_ROOT}/hack/boilerplate/boilerplate.go.txt ${CODEGEN_PKG}/hack/boilerplate.go.txt
|
||||
chmod +x ${CODEGEN_PKG}/*.sh
|
||||
|
||||
${CODEGEN_PKG}/generate-groups.sh "deepcopy" \
|
||||
k8s.io/ingress-nginx/internal k8s.io/ingress-nginx/internal \
|
||||
.:ingress \
|
||||
--output-base "$(dirname ${BASH_SOURCE})/../../.."
|
||||
--output-base "$(dirname ${BASH_SOURCE})/../../.." \
|
||||
--go-header-file ${SCRIPT_ROOT}/hack/boilerplate/boilerplate.go.txt
|
|
@ -83,7 +83,7 @@ export EXIT_CODE=-1
|
|||
echo "
|
||||
make -C ${DIR}/../../ clean-image build image
|
||||
make -C ${DIR}/../e2e-image image
|
||||
make -C ${DIR}/../../images/fastcgi-helloserver/ GO111MODULE=\"on\" build image
|
||||
make -C ${DIR}/../../images/fastcgi-helloserver/ build image
|
||||
make -C ${DIR}/../../images/httpbin/ image
|
||||
make -C ${DIR}/../../images/echo/ image
|
||||
make -C ${DIR}/../../images/cfssl/ image
|
||||
|
|
Loading…
Reference in a new issue