Builds a `vikunja`-binary in the root directory of the repo for the platform it is run on.
### Statically compile all templates into the binary
{{<highlightbash>}}
mage build:generate
{{</highlight>}}
This generates static code with all templates, meaning no template need to be referenced at runtime.
### clean
{{<highlightbash>}}
mage build:clean
{{</highlight>}}
Cleans all build, executable and bindata files
## Check
All check sub-commands exit with a status code of 1 if the check fails.
Various code-checks are available:
*`mage check:all`: Runs fmt-check, lint, got-swag, misspell-check, ineffasign-check, gocyclo-check, static-check, gosec-check, goconst-check all in parallel
*`mage check:fmt`: Checks if the code is properly formatted with go fmt
*`mage check:go-sec`: Checks the source code for potential security issues by scanning the Go AST using the [gosec tool](https://github.com/securego/gosec)
*`mage check:goconst`: Checks for repeated strings that could be replaced by a constant using [goconst](https://github.com/jgautheron/goconst/)
*`mage check:gocyclo`: Checks for the cyclomatic complexity of the source code using [gocyclo](https://github.com/fzipp/gocyclo)
*`mage check:got-swag`: Checks if the swagger docs need to be re-generated from the code annotations
*`mage check:ineffassign`: Checks the source code for ineffectual assigns using [ineffassign](https://github.com/gordonklaus/ineffassign)
*`mage check:lint`: Runs golint on all packages
*`mage check:misspell`: Checks the source code for misspellings
*`mage check:static`: Statically analyzes the source code about a range of different problems using [staticcheck](https://staticcheck.io/docs/)
## Release
### Build Releases
{{<highlightbash>}}
mage release
{{</highlight>}}
Builds binaries for all platforms and zips them with a copy of the `templates/` folder.
All built zip files are stored into `dist/zips/`. Binaries are stored in `dist/binaries/`,
binaries bundled with `templates` are stored in `dist/releases/`.
All cross-platform binaries built using this series of commands are built with the help of
[xgo](https://github.com/techknowlogick/xgo). The mage command will automatically install the
binary to be able to use it.
`mage release:release` is a shortcut to execute `mage release:dirs release:windows release:linux release:darwin release:copy release:check release:os-package release:zip`.
*`mage release:dirs` creates all directories needed
*`mage release:windows`/`release:linux`/`release:darwin` execute xgo to build for their respective platforms
*`mage release:copy` bundles binaries with a copy of the `LICENSE` and sample config files to then be zipped
*`mage release:check` creates sha256 checksums for each binary which will be included in the zip file
*`mage release:os-package` bundles a binary with the `sha256` checksum file, a sample `config.yml` and a copy of the license in a folder for each architecture
*`mage release:compress` compresses all build binaries with `upx` to save space
*`mage release:zip` paclages a zip file for the files created by `release:os-package`