Skip to content

Commit baae188

Browse files
erthalionFxKu
authored andcommitted
Replace glide with Go modules (zalando#544)
* And attempt to build with modules and remove glide * new tools.go file to get code-generator dependency + updated codegen + remove Glide files and update docs
1 parent f0e2906 commit baae188

File tree

21 files changed

+487
-400
lines changed

21 files changed

+487
-400
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ _testmain.go
2424
*.test
2525
*.prof
2626
/vendor/
27-
/.glide/
2827
/build/
2928
/docker/build/
3029
.idea

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ go:
1111
- "1.12.x"
1212

1313
before_install:
14-
- go get github.com/Masterminds/glide
1514
- go get github.com/mattn/goveralls
1615

1716
install:

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ scm-source.json: .git
7878
echo '{\n "url": "git:$(GITURL)",\n "revision": "$(GITHEAD)",\n "author": "$(USER)",\n "status": "$(GITSTATUS)"\n}' > scm-source.json
7979

8080
tools:
81-
@go get -u honnef.co/go/tools/cmd/staticcheck
82-
@go get -u github.com/Masterminds/glide
81+
GO111MODULE=on go get -u honnef.co/go/tools/cmd/staticcheck
82+
GO111MODULE=on go get k8s.io/client-go@kubernetes-1.16.0
8383

8484
fmt:
8585
@gofmt -l -w -s $(DIRS)
@@ -89,11 +89,11 @@ vet:
8989
@staticcheck $(PKG)
9090

9191
deps:
92-
@glide install --strip-vendor
92+
GO111MODULE=on go mod vendor
9393

9494
test:
9595
hack/verify-codegen.sh
96-
@go test ./...
96+
@go test ./pkg/...
9797

9898
e2e: docker # build operator image to be tested
9999
cd e2e; make tools test clean

delivery.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ version: "2017-09-20"
22
pipeline:
33
- id: build-postgres-operator
44
type: script
5-
env:
6-
GOPATH: /root/go
7-
OPERATOR_TOP_DIR: /root/go/src/github.com/zalando
85
commands:
96
- desc: 'Update'
107
cmd: |
@@ -20,10 +17,6 @@ pipeline:
2017
mv go /usr/local
2118
ln -s /usr/local/go/bin/go /usr/bin/go
2219
go version
23-
- desc: 'Symlink sources into the GOPATH'
24-
cmd: |
25-
mkdir -p $OPERATOR_TOP_DIR
26-
ln -s $(pwd) $OPERATOR_TOP_DIR/postgres-operator
2720
- desc: 'Build docker image'
2821
cmd: |
2922
export PATH=$PATH:$HOME/go/bin
@@ -39,11 +32,9 @@ pipeline:
3932
- desc: 'Run unit tests'
4033
cmd: |
4134
export PATH=$PATH:$HOME/go/bin
42-
cd $OPERATOR_TOP_DIR/postgres-operator
4335
go test ./pkg/...
4436
- desc: 'Run e2e tests'
4537
cmd: |
46-
cd $OPERATOR_TOP_DIR/postgres-operator
4738
make e2e
4839
- desc: 'Push docker image'
4940
cmd: |

docs/developer.md

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,17 @@ git clone https://github.com/zalando/postgres-operator.git
2727

2828
## Building the operator
2929

30-
You need Glide to fetch all dependencies. Install it with:
30+
We use [Go Modules](https://github.com/golang/go/wiki/Modules) for handling
31+
dependencies. When using Go below v1.13 you need to explicitly enable Go modules
32+
by setting the `GO111MODULE` environment variable to `on`. The make targets do
33+
this for you, so simply run
3134

3235
```bash
33-
make tools
34-
```
35-
36-
Next, install dependencies with glide by issuing:
37-
38-
```bash
39-
make deps
36+
make tools deps
4037
```
4138

4239
This would take a while to complete. You have to redo `make deps` every time
43-
you dependencies list changes, i.e. after adding a new library dependency.
40+
your dependencies list changes, i.e. after adding a new library dependency.
4441

4542
Build the operator with the `make docker` command. You may define the TAG
4643
variable to assign an explicit tag to your docker image and the IMAGE to set
@@ -214,14 +211,7 @@ dlv connect 127.0.0.1:DLV_PORT
214211
To run all unit tests, you can simply do:
215212

216213
```bash
217-
go test ./...
218-
```
219-
220-
For go 1.9 `vendor` directory would be excluded automatically. For previous
221-
versions you can exclude it manually:
222-
223-
```bash
224-
go test $(glide novendor)
214+
go test ./pkg/...
225215
```
226216

227217
In case if you need to debug your unit test, it's possible to use delve:

0 commit comments

Comments
 (0)