# Coding style Before submitting a pull request: - Please run `make check` and fix all warnings and errors. - When changing the API, run `go doc -http` and check how the documentation looks. As a general rule of thumb, we prefer idiomatic Go code as described in: - [Effective Go](https://golang.org/doc/effective_go.html) - [Collected Go Code Review Comments](https://github.com/golang/go/wiki/CodeReviewComments) # Running the unit tests The unit tests require a Swift server (duh). ## Using a Swift cluster The preferred option is a regular Swift deployment: Run `go test` with the same authentication variables that you give to the official `swift` client: - for Swift inside an OpenStack cluster: `OS_AUTH_URL`, `OS_USERNAME`, `OS_PASSWORD`, etc. - for Swift using its builtin authentication: `ST_AUTH`, `ST_USER`, `ST_KEY` ## Using a Swift All-in-One container If you don't have a Swift deployment at your disposal where you're running the unit tests, you can use the scripts in the [`testing` subdirectory](./testing/) to run a Swift all-in-one (SAIO) [development setup in a Docker container](https://github.com/bouncestorage/docker-swift). 1. Run `./testing/start-saio.sh` to start the SAIO container (possibly with `sudo` if your user is not in the `docker` group). Once that has come up successfully, press Ctrl-C to get back to your terminal prompt; the SAIO container will continue running. 2. Run the tests with `./testing/with-saio.sh make check`. The script will find how to access the Swift API inside the container, and configure the auth environment variables accordingly. You can use this with any command that requires Swift credentials, e.g. `./testing/with-saio.sh swift stat`.