Cloning this repository and change directory to it:
$ go get -d github.com/cnabio/duffle/...
$ cd $(go env GOPATH)/src/github.com/cnabio/duffleYou need:
- make
- Docker
To ensure a consistent development environment for all contributors, Duffle relies heavily on Docker containers as sandboxes for all development activities including dependency resolution and executing tests.
make targets seamlessly handle the container orchestration.
If, for whatever reason, you must opt-out of executing development tasks within
containers, set the SKIP_DOCKER environment variable to true, but be aware
that by doing so, the success or failure of development-related tasks, tests,
etc. will be dependent on the state of your system, with no guarantee of the
same results in CI.
All development-related tasks should "just work" on Linux and Mac OS systems. When developing on Windows, the maintainers strongly recommend utilizing the Windows Subsystem for Linux.
This blog post provides excellent guidance on making the Windows Subsystem for Linux work seamlessly with Docker Desktop (Docker for Windows).
To build everything (binaries for Linux, Mac, and Windows on amd64 architecture) as well as a linux/amd64 Docker image containing the corresponding binary:
$ make buildTo build binaries for Linux, Mac, and Windows, but no Docker image:
$ make build-all-binsTo build for one specific OS / architecture:
$ GOOS=<desired OS> GOARCH=<desired architecture> make build-binFor convenience, you can build for the OS of your choice with amd64 architecture
using targets of the form build-<OS>. For example:
$ make build-darwinTo build only the Docker image and nothing else:
$ make build-imageTo run the tests, issue:
$ make testTo lint the code, issue:
$ make lintIf this detects that some imports need re-organising (errors like "File is not goimports-ed"), issue:
$ make goimportsIf, at any time, you need to (re-)resolve the project's dependencies, perhaps because a new one is needed or an existing one is no longer needed, issue:
$ make depFor instructions on using VS Code to debug the Duffle binary, see the debugging document.
To create a release, simply push a tag and CI will do the rest. The tag should be of the form:
<major>.<minor>.<patch>[-<pre-release>]Tags conform to Semantic Versioning in syntax and semantics, but must not start with v.
Examples tags are: 0.3.0-beta.3 and 1.0.0.