Skip to content

Commit b1de37b

Browse files
committed
build: use go modules to manage dependencies
Move us onto module for primary project dependencies. We also get code-generator pinned down using modules with go mod vendor. Due to a lack of release of GOPATHless upstreams, GOPATH is still required to update code-generation. Signed-off-by: Stephen Day <[email protected]>
1 parent e822ad8 commit b1de37b

File tree

2,182 files changed

+404
-726151
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,182 files changed

+404
-726151
lines changed

.travis.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
language: go
66

77
go:
8-
- "1.11.x"
8+
- "1.13.x"
99

1010
go_import_path: github.com/cruise-automation/rbacsync
1111

@@ -16,6 +16,5 @@ install:
1616

1717
script:
1818
- GIT_CHECK_EXCLUDE="./vendor" git-validation -q -run DCO,short-subject,dangling-whitespace
19-
# TODO(stevvooe): Add vendor check validation.
2019
- make build
2120
- make test

Makefile

+1-15
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ COVERPACKAGES=$(shell go list ./... | grep -v /vendor/ | grep -v /generated/ | g
2323

2424
GO_LDFLAGS=-ldflags '-s -w -X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PKG) $(EXTRA_LDFLAGS)'
2525
TESTFLAGS=-race -v
26-
COVERFLAGS=-coverpkg=$(COVERPACKAGES) -covermode=atomic -coverprofile=coverage.out
2726

28-
.PHONY: all generate build test binaries clean FORCE vndr image deploy test-coverage .deps.coverage
27+
.PHONY: all generate build test binaries clean FORCE image deploy
2928

3029
all: binaries
3130
FORCE: # force targets to run no matter what
@@ -44,16 +43,6 @@ bin/%: cmd/% FORCE
4443
test:
4544
go test ${TESTFLAGS} ${PACKAGES} -logtostderr # for some reason, this flag only works on the end
4645

47-
test-coverage: .deps.coverage
48-
go test ${TESTFLAGS} ${COVERFLAGS} ${PACKAGES} -logtostderr # for some reason, this flag only works on the end
49-
gocov convert coverage.out | gocov-xml > coverage.xml
50-
go tool cover -html coverage.out -o coverage.html
51-
52-
.deps.coverage:
53-
# Installs coverage deps using go get. Should be replaced by something better.
54-
go get github.com/axw/gocov/...
55-
go get github.com/AlekSi/gocov-xml
56-
5746
image:
5847
docker build -t rbacsync:${VERSION_TAG} .
5948

@@ -69,9 +58,6 @@ deploy: push
6958
kubectl apply -f deploy/
7059
kubectl set image deploy/rbacsync rbacsync=${REGISTRY}rbacsync:${VERSION_TAG}
7160

72-
vndr:
73-
vndr
74-
7561
clean:
7662
rm -rf bin/*
7763

go.mod

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module github.com/cruise-automation/rbacsync
2+
3+
go 1.13
4+
5+
require (
6+
github.com/Azure/go-autorest/autorest v0.9.4 // indirect
7+
github.com/Azure/go-autorest/autorest/adal v0.8.1 // indirect
8+
github.com/davecgh/go-spew v1.1.1
9+
github.com/gophercloud/gophercloud v0.7.0 // indirect
10+
github.com/imdario/mergo v0.3.8 // indirect
11+
github.com/pkg/errors v0.9.1
12+
github.com/prometheus/client_golang v1.4.0
13+
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
14+
google.golang.org/api v0.15.0
15+
gopkg.in/yaml.v2 v2.2.8
16+
k8s.io/api v0.17.2
17+
k8s.io/apimachinery v0.17.2
18+
k8s.io/client-go v0.17.0
19+
k8s.io/code-generator v0.17.2
20+
k8s.io/klog v1.0.0
21+
k8s.io/utils v0.0.0-20200124190032-861946025e34 // indirect
22+
)

go.sum

+366
Large diffs are not rendered by default.

hack/tools.go

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// +build tools
2+
3+
package tools
4+
5+
import _ "k8s.io/code-generator"

hack/update-codegen.sh

+9-15
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,19 @@
1818
set -o errexit
1919
set -o nounset
2020
set -o pipefail
21-
set -o xtrace
2221

23-
if [[ -z "${GOPATH}" ]]; then
24-
GOPATH=~/go
25-
fi
26-
27-
if [[ ! -d "${GOPATH}/src/k8s.io/code-generator" ]]; then
28-
echo "k8s.io/code-generator missing from GOPATH"
29-
exit 1
30-
fi
31-
32-
cd ${GOPATH}/src/k8s.io/code-generator
22+
SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
23+
CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)}
3324

3425
pkgroot=github.com/cruise-automation/rbacsync
3526

36-
./generate-groups.sh \
27+
# TODO(stevvooe): Once new code-generator is released with 1.18, GOPATH is no
28+
# longer required for generation and this variable can be removed.
29+
GOPATH="$(go env GOPATH)" bash "${CODEGEN_PKG}"/generate-groups.sh \
3730
all \
38-
github.com/cruise-automation/rbacsync/pkg/generated \
39-
github.com/cruise-automation/rbacsync/pkg/apis \
31+
"${pkgroot}"/pkg/generated \
32+
"${pkgroot}"/pkg/apis \
4033
rbacsync:v1alpha \
34+
--output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \
35+
--go-header-file "${SCRIPT_ROOT}"/hack/boilerplate.go.txt
4136
$@
42-

vendor/cloud.google.com/go/LICENSE

-202
This file was deleted.

0 commit comments

Comments
 (0)