Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace glide with Go modules #544

Merged
merged 2 commits into from
Oct 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ _testmain.go
*.test
*.prof
/vendor/
/.glide/
/build/
/docker/build/
.idea
Expand Down
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ go:
- "1.12.x"

before_install:
- go get github.com/Masterminds/glide
- go get github.com/mattn/goveralls

install:
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ scm-source.json: .git
echo '{\n "url": "git:$(GITURL)",\n "revision": "$(GITHEAD)",\n "author": "$(USER)",\n "status": "$(GITSTATUS)"\n}' > scm-source.json

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

fmt:
@gofmt -l -w -s $(DIRS)
Expand All @@ -89,11 +89,11 @@ vet:
@staticcheck $(PKG)

deps:
@glide install --strip-vendor
GO111MODULE=on go mod vendor

test:
hack/verify-codegen.sh
@go test ./...
@go test ./pkg/...

e2e: docker # build operator image to be tested
cd e2e; make tools test clean
9 changes: 0 additions & 9 deletions delivery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ version: "2017-09-20"
pipeline:
- id: build-postgres-operator
type: script
env:
GOPATH: /root/go
OPERATOR_TOP_DIR: /root/go/src/github.com/zalando
commands:
- desc: 'Update'
cmd: |
Expand All @@ -20,10 +17,6 @@ pipeline:
mv go /usr/local
ln -s /usr/local/go/bin/go /usr/bin/go
go version
- desc: 'Symlink sources into the GOPATH'
cmd: |
mkdir -p $OPERATOR_TOP_DIR
ln -s $(pwd) $OPERATOR_TOP_DIR/postgres-operator
- desc: 'Build docker image'
cmd: |
export PATH=$PATH:$HOME/go/bin
Expand All @@ -39,11 +32,9 @@ pipeline:
- desc: 'Run unit tests'
cmd: |
export PATH=$PATH:$HOME/go/bin
cd $OPERATOR_TOP_DIR/postgres-operator
go test ./pkg/...
- desc: 'Run e2e tests'
cmd: |
cd $OPERATOR_TOP_DIR/postgres-operator
make e2e
- desc: 'Push docker image'
cmd: |
Expand Down
24 changes: 7 additions & 17 deletions docs/developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,17 @@ git clone https://github.com/zalando/postgres-operator.git

## Building the operator

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

```bash
make tools
```

Next, install dependencies with glide by issuing:

```bash
make deps
make tools deps
```

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

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

```bash
go test ./...
```

For go 1.9 `vendor` directory would be excluded automatically. For previous
versions you can exclude it manually:

```bash
go test $(glide novendor)
go test ./pkg/...
```

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