Skip to content

Commit 5116b59

Browse files
authored
Merge 78d4989 into 1602407
2 parents 1602407 + 78d4989 commit 5116b59

File tree

3,000 files changed

+50
-1079768
lines changed

Some content is hidden

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

3,000 files changed

+50
-1079768
lines changed

.github/workflows/go.yaml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,36 @@
11
name: Go
22
on:
33
push:
4-
branches:
4+
branches:
55
- master
6+
- main
67
pull_request:
7-
branches:
8+
branches:
89
- master
10+
- main
911
jobs:
1012
build:
1113
name: Build
1214
runs-on: ubuntu-latest
1315
steps:
16+
- name: Check out code into the Go module directory
17+
uses: actions/checkout@v2
1418
- name: Set up Go
1519
uses: actions/setup-go@v2
1620
with:
1721
go-version: 1.16
1822
id: go
19-
- name: Check out code into the Go module directory
20-
uses: actions/checkout@v2
23+
- name: Cache dependencies
24+
uses: actions/cache@v2
25+
with:
26+
path: |
27+
~/.cache/go-build
28+
~/go/pkg/mod
29+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
30+
restore-keys: |
31+
${{ runner.os }}-go-
2132
- name: unit-test
22-
run: go test -mod=vendor -v ./...
33+
run: go test -v ./...
2334

2435
go-apidiff:
2536
name: go-apidiff

.github/workflows/verify.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
push:
44
branches:
55
- master
6+
- main
67
pull_request:
78
paths:
89
- '**'

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@
1818
.LSOverride
1919

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

Makefile

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ endif
1111

1212
REPO = github.com/operator-framework/api
1313
BUILD_PATH = $(REPO)/cmd/operator-verify
14-
PKGS = $(shell go list ./... | grep -v /vendor/)
15-
YQ := go run $(MOD_FLAGS) ./vendor/github.com/mikefarah/yq/v3/
14+
PKGS = $(shell go list ./...)
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

Lines changed: 1 addition & 2 deletions
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,5 +18,4 @@ require (
1818
k8s.io/apimachinery v0.22.1
1919
k8s.io/client-go v0.22.1
2020
sigs.k8s.io/controller-runtime v0.10.0
21-
sigs.k8s.io/controller-tools v0.6.2
2221
)

go.sum

Lines changed: 0 additions & 110 deletions
Large diffs are not rendered by default.

tools.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
package tools
44

55
import (
6-
// Generate deepcopy and conversion.
7-
_ "sigs.k8s.io/controller-tools/cmd/controller-gen"
8-
// Manipulate YAML.
9-
_ "github.com/mikefarah/yq/v3"
106
// Generate embedded files.
117
_ "github.com/go-bindata/go-bindata/v3/go-bindata"
128
)

vendor/github.com/PuerkitoBio/purell/.gitignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

vendor/github.com/PuerkitoBio/purell/.travis.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

vendor/github.com/PuerkitoBio/purell/LICENSE

Lines changed: 0 additions & 12 deletions
This file was deleted.

vendor/github.com/PuerkitoBio/purell/README.md

Lines changed: 0 additions & 188 deletions
This file was deleted.

0 commit comments

Comments
 (0)