Skip to content

Commit 73f2f9e

Browse files
authored
Purge the root vendor directory (#213)
* Ignore the root vendor directory * Remove the root vendor directory Signed-off-by: timflannagan <[email protected]> * Ignore the root bin directory * Remove tool dependencies that are installed at runtime from root module * Update workflows and Makefile to avoid referencing the vendor directory Signed-off-by: timflannagan <[email protected]>
1 parent bfa93d1 commit 73f2f9e

File tree

2,992 files changed

+46
-1109883
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,992 files changed

+46
-1109883
lines changed

.github/workflows/go.yaml

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Go
22
on:
33
push:
4-
branches:
4+
branches:
55
- master
66
pull_request:
7-
branches:
7+
branches:
88
- master
99
jobs:
1010
build:
@@ -18,8 +18,17 @@ jobs:
1818
id: go
1919
- name: Check out code into the Go module directory
2020
uses: actions/checkout@v2
21+
- name: Cache dependencies
22+
uses: actions/cache@v2
23+
with:
24+
path: |
25+
~/.cache/go-build
26+
~/go/pkg/mod
27+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
28+
restore-keys: |
29+
${{ runner.os }}-go-
2130
- name: unit-test
22-
run: go test -mod=vendor -v ./...
31+
run: go test -v ./...
2332

2433
go-apidiff:
2534
name: go-apidiff
@@ -31,6 +40,8 @@ jobs:
3140
with:
3241
go-version: 1.17
3342
id: go
43+
- name: Print out Go env
44+
run: go env
3445
- name: Check out code into the Go module directory
3546
uses: actions/checkout@v2
3647
with:

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@
1818
.LSOverride
1919

2020
.idea/*
21+
vendor/
22+
bin/

Makefile

+29-12
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ endif
1212
REPO = github.com/operator-framework/api
1313
BUILD_PATH = $(REPO)/cmd/operator-verify
1414
PKGS = $(shell go list ./... | grep -v /vendor/)
15-
YQ := go run $(MOD_FLAGS) ./vendor/github.com/mikefarah/yq/v3/
1615

1716
.PHONY: help
1817
help: ## Show this help screen
@@ -25,7 +24,6 @@ help: ## Show this help screen
2524
.PHONY: install
2625

2726
install: ## Build & install operator-verify
28-
2927
$(Q)go install \
3028
-gcflags "all=-trimpath=${GOPATH}" \
3129
-asmflags "all=-trimpath=${GOPATH}" \
@@ -35,25 +33,25 @@ install: ## Build & install operator-verify
3533
" \
3634
$(BUILD_PATH)
3735

36+
###
3837
# Code management.
39-
.PHONY: format tidy clean vendor generate manifests
38+
###
39+
.PHONY: format tidy clean generate manifests
4040

4141
format: ## Format the source code
4242
$(Q)go fmt $(PKGS)
4343

4444
tidy: ## Update dependencies
4545
$(Q)go mod tidy -v
46-
47-
vendor: tidy ## Update vendor directory
48-
$(Q)go mod vendor
46+
$(Q)go mod verify
4947

5048
clean: ## Clean up the build artifacts
5149
$(Q)rm -rf build
5250

5351
generate: controller-gen ## Generate code
5452
$(CONTROLLER_GEN) object:headerFile=./hack/boilerplate.go.txt paths=./...
5553

56-
manifests: controller-gen ## Generate manifests e.g. CRD, RBAC etc
54+
manifests: yq controller-gen ## Generate manifests e.g. CRD, RBAC etc
5755
@# Create CRDs for new APIs
5856
$(CONTROLLER_GEN) crd:crdVersions=v1 output:crd:dir=./crds paths=./pkg/operators/...
5957

@@ -88,9 +86,28 @@ test-unit: ## Run the unit tests
8886
verify: manifests generate format
8987
git diff --exit-code
9088

89+
###
9190
# Utilities.
92-
.PHONY: controller-gen
93-
94-
controller-gen: vendor ## Find or download controller-gen
95-
CONTROLLER_GEN=$(Q)go run -mod=vendor ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen
96-
91+
###
92+
93+
# go-get-tool will 'go get' any package $2 and install it to $1.
94+
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
95+
define go-get-tool
96+
@[ -f $(1) ] || { \
97+
set -e ;\
98+
TMP_DIR=$$(mktemp -d) ;\
99+
cd $$TMP_DIR ;\
100+
go mod init tmp ;\
101+
echo "Downloading $(2)" ;\
102+
GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\
103+
rm -rf $$TMP_DIR ;\
104+
}
105+
endef
106+
107+
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
108+
controller-gen: ## Download controller-gen locally if necessary.
109+
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/[email protected])
110+
111+
YQ = $(shell pwd)/bin/yq
112+
yq:
113+
$(call go-get-tool,$(YQ),github.com/mikefarah/yq/v3)

go.mod

+1-11
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/ghodss/yaml v1.0.0
99
github.com/go-bindata/go-bindata/v3 v3.1.3
1010
github.com/google/cel-go v0.9.0
11-
github.com/mikefarah/yq/v3 v3.0.0-20201202084205-8846255d1c37
11+
github.com/google/go-cmp v0.5.6 // indirect
1212
github.com/sirupsen/logrus v1.8.1
1313
github.com/spf13/cobra v1.2.1
1414
github.com/stretchr/testify v1.7.0
@@ -18,7 +18,6 @@ require (
1818
k8s.io/apimachinery v0.23.0
1919
k8s.io/client-go v0.23.0
2020
sigs.k8s.io/controller-runtime v0.11.0
21-
sigs.k8s.io/controller-tools v0.8.0
2221
)
2322

2423
require (
@@ -29,18 +28,14 @@ require (
2928
github.com/beorn7/perks v1.0.1 // indirect
3029
github.com/cespare/xxhash/v2 v2.1.1 // indirect
3130
github.com/davecgh/go-spew v1.1.1 // indirect
32-
github.com/fatih/color v1.12.0 // indirect
3331
github.com/felixge/httpsnoop v1.0.1 // indirect
3432
github.com/go-logr/logr v1.2.0 // indirect
3533
github.com/go-openapi/jsonpointer v0.19.5 // indirect
3634
github.com/go-openapi/jsonreference v0.19.5 // indirect
3735
github.com/go-openapi/swag v0.19.14 // indirect
38-
github.com/gobuffalo/flect v0.2.3 // indirect
39-
github.com/goccy/go-yaml v1.8.1 // indirect
4036
github.com/gogo/protobuf v1.3.2 // indirect
4137
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
4238
github.com/golang/protobuf v1.5.2 // indirect
43-
github.com/google/go-cmp v0.5.6 // indirect
4439
github.com/google/gofuzz v1.1.0 // indirect
4540
github.com/googleapis/gnostic v0.5.5 // indirect
4641
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
@@ -49,15 +44,11 @@ require (
4944
github.com/josharian/intern v1.0.0 // indirect
5045
github.com/json-iterator/go v1.1.12 // indirect
5146
github.com/kisielk/errcheck v1.5.0 // indirect
52-
github.com/kylelemons/godebug v1.1.0 // indirect
5347
github.com/mailru/easyjson v0.7.6 // indirect
54-
github.com/mattn/go-colorable v0.1.8 // indirect
55-
github.com/mattn/go-isatty v0.0.12 // indirect
5648
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
5749
github.com/mitchellh/mapstructure v1.4.1 // indirect
5850
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
5951
github.com/modern-go/reflect2 v1.0.2 // indirect
60-
github.com/pkg/errors v0.9.1 // indirect
6152
github.com/pmezard/go-difflib v1.0.0 // indirect
6253
github.com/prometheus/client_golang v1.11.0 // indirect
6354
github.com/prometheus/client_model v0.2.0 // indirect
@@ -89,7 +80,6 @@ require (
8980
google.golang.org/grpc v1.40.0 // indirect
9081
google.golang.org/protobuf v1.27.1 // indirect
9182
gopkg.in/inf.v0 v0.9.1 // indirect
92-
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473 // indirect
9383
gopkg.in/yaml.v2 v2.4.0 // indirect
9484
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
9585
k8s.io/apiserver v0.23.0 // indirect

0 commit comments

Comments
 (0)