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

Replacing dep with go modules #662

Merged
merged 12 commits into from
Jan 4, 2019
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ cache:

script:
- ./build.sh setup
- ./build.sh vendor
- ./build.sh utils
- ./build.sh protobuf_verify
- ./build.sh test
Expand Down Expand Up @@ -42,8 +41,8 @@ deploy:
on:
tags: true
condition: $GITHUB_TOKEN != ""

notifications:
slack:
secure: auV9VWkA50+tf4cKUUkMH/KqggKSJCBV9ruLSF1LVgqQYnK34rp/PPzx4gTiQYA07ltnu8Hi13XMoN5+OFsRfzVRCKP1tlGuTvVhpsoyMGiNxBY1Yw2OhZXRoSjCwJkuBsAkkaxAgsC58IEnxhKq+M83dDYx+WiybO+aQnQ6ExbGE4oUBhhBkYKrHy4Kt9/3yWLqicV/VXFtvwbXG5OG1zNNOYCUEud4Y8j6pcb0kyVqlHFjAjasLPsln0QSaTxOThLZCxMZD2zpbI1xxO5tBusqDe1QOMSgsyAbDaNk7wCb2kU+0hRKcfiuWShrswhECSJsYUImLq4c77WbdhrjRgscgY2779T/jaJHbG3Lx7GlDWYLSgFcM8VfZK+K5XPcm35F2qGPiEjtYEEAPS2qQM9PZyvTEVPxjNEc2PE3bINTjibcKbfATNa1ULQvJ6ixtSL9Ao8828iUfaR0mK4eaWnJckov5OaGvah+v6vh49JqZTEN3Or8XTUw0ra14euS6jR30XB2Y3S8/0NuvHY+ytJe36yQn9FdFM3asNpBuNP7F9v00WJr3+Lhg7KHMd0m19ulwtmXiWJYU25AVMk/oXp+aq+678AvhYkYZGaUzC3timsuTlAjH9DA9yxBW+8KE9y46Jq8vXHXhKTfdKDVVUyOFxKKGAjCA5QbeKx+5QU=

21 changes: 7 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ from the SPIFFE project.

For basic development you will need:

* **Go** (https://golang.org/dl/)
* **Dep**, for managing third-party dependancies (https://github.com/golang/dep)
* **Go 1.11** or higher (https://golang.org/dl/)

For development that requires changes to the gRPC interfaces you will need:

Expand All @@ -22,25 +21,23 @@ For development that requires changes to the gRPC interfaces you will need:

# Building

It is assumed that this repository lives in $GOPATH/src/github.com/spiffe/spire on your local disk,
and that your GOPATH only contains one element.
Since go modules are used, this repository can live in any folder on your local disk (it is not required to be in GOPATH).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a reminder here to set env flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so... It is not required to set the GO111MODULE env flag manually if SPIRE is built using make. This variable is exported in the Makefile (line 13).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thanks @marcosy !

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, if unset, or set to auto, go modules mode will be automatically activated if the current directory (or a parent directory) contains a valid go.mod file. So you should be able to check out the repo, step into the directory, and run go build github.com/spiffe/spire/cmd/spire-server and have it just work.


Because of the use of dep and the unusual layout of this repository a Makefile is provide for
common actions.
A Makefile is provided for common actions.

* `dep ensure` - installs all the dependencies listed in Gopkg.toml
* `make all` - installs 3rd-party dependencies, build all binaries, and run all tests
* `make` - builds all binaries
* `make cmd/spire-agent` - builds one binary
* `make test` - runs all tests

**Other Makefile targets**

* `vendor` - installs 3rd-party dependencies using dep
* `vendor` - Make vendored copy of dependencies using go mod
* `race-test` - run `go test -race`
* `clean` - cleans `vendor` directory, dep cache
* `clean` - cleans `vendor` directory
* `distclean` - removes caches in addition to `make clean`
* `utils` - installs gRPC related development utilities
* `help` - shows makefile targets and description

## Development in Docker

Expand All @@ -60,10 +57,7 @@ $ make container
$ make cmd
```

Because the docker container shares $GOPATH you will not have to re-install the go dependencies
every time you run the container. NOTE: any binaries installed from within the container will be
located in $GOPATH/bin/linux_amd64 to avoid conflicts with the host OS (Packages are automatically
versioned by golang into `$GOPATH/pkg/<os>_<arch>`)
Because the docker container shares `$GOPATH/pkg/mod` you will not have to re-install the go dependencies every time you run the container.

## CI

Expand All @@ -74,7 +68,6 @@ checks. It is also used to bootstrap the Go environment in the Docker container.
* `protobuf` - regenerate the gRPC pb.go and README.md files
* `protobuf_verify` - check that the checked-in generated code is up-to-date
* `distclean` - calls `make distclean` and removes the directory `.build-<os>-<arch>`
* `vendor` - calls `make vendor` and checks that the `Gopkg.lock` file is up-to-date
* `artifact` - generate a `.tgz` containing all of the SPIFFE binaries
* `test` - when called from within a Travis-CI build, runs coverage tests in addition to the
regular tests
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ ENV GOROOT=/root/build
ENV GOBIN=$GOPATH/bin/linux_amd64
ENV PATH=$GOROOT/bin:$GOBIN:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN mkdir /root/go
WORKDIR /root/go/src/github.com/spiffe/spire
WORKDIR /root/spire
Loading