Currently, all modules within Podkrepi.bg are built using Go 1.16. Taskfile is used to specify the build steps for each module and golangci-lint is used for linting the code.
The easiest way to start developing Go modules for Podkrepi.bg is by using Visual Studio Code. Make sure the Remote Containers extension is installed. It provides an easy way to configure a container as a development environment. This can be done by adding a .devcontainer/devcontainer.json
to the root of the workspace. In most cases, it is sufficient to copy the contents of this example:
{
"name": "Go",
"image": "ghcr.io/podkrepi-bg/go-devcontainer:v1.1.0",
"settings": {
"go.useLanguageServer": true
},
"extensions": [
"golang.go",
"ms-azuretools.vscode-docker"
],
"mounts": [
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"
]
}
Create a Taskfile.yml
in the root of the workspace. The configuration below contains a lint and a build step for a Go module. Consider specifying generates
property for the tasks such that the tool can determine whether a step has to run or not based on the generated files' checksum. For more info see this link.
# https://taskfile.dev
version: '3'
tasks:
lint:
cmds:
- golangci-lint run
build:
cmds:
- go build .
silent: false
After the file is created, you can run the following command to lint the Go module:
task lint
TODO