Skip to content

Commit

Permalink
new tools.go file to get code-generator dependency + updated codegen …
Browse files Browse the repository at this point in the history
…+ remove Glide files and update docs
  • Loading branch information
FxKu committed Oct 2, 2019
1 parent fd89e90 commit 77330e2
Show file tree
Hide file tree
Showing 22 changed files with 461 additions and 454 deletions.
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
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

service:
prepare:
- make GO111MODULE=on deps
- make deps
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ before_install:
- go get github.com/mattn/goveralls

install:
- make GO111MODULE=on deps
- make deps

script:
- hack/verify-codegen.sh
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +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
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 @@ -88,11 +89,11 @@ vet:
@staticcheck $(PKG)

deps:
@go mod 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
1 change: 0 additions & 1 deletion delivery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ pipeline:
IMAGE=registry-write.opensource.zalan.do/acid/postgres-operator-test
fi
export IMAGE
export GO111MODULE=on
make tools deps docker
- desc: 'Run unit tests'
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

0 comments on commit 77330e2

Please sign in to comment.