go mod tidy before publishing changes//nolint:all..golangci.yaml file in the root of a codebase) must be approved by a Go developer//nolint:xxx go directives are allowedgofmt before publishing changes
Specifications requiring changes of Go code need sign-off (thumbs up) from a Go developer
.gitignore with a default ignored files from https://www.toptal.com/developers/gitignore.golangci.yaml with contents copied from some other Go codebase and adjusted for the new repositories needs. Currently, best source for an up-to-date .golangci.yaml file is MSSQL pluginREADME.mdWhen restructuring code (moving files or functions) the changes made are not considered "New Code", but changes will be caught by lint, so when doing restructuring changes you will likely need to fix lint issues in the moved code.
You make changes to plugin-support, you have to apply the new plugin-support to all components that use it.
Since plugin-support does not have version tags, that Go module versioning could use, we have to make do with commit hashes. The commit hashes used in components must be from release branches, not development branches.
The previous guideline rule defines the merge order requirement. Merge dependencies first, retrieve the commit hash from merge to release branch, apply the dependency commit hash to a component, and only then merge the component's dev branch into a release branch.
G - Agent 2 and its surrounding components (e.g. plugin-support and plugins (PostgreSQL, MongoDB, MSSQL))
...G...... [{ticket_id}] messageT - Zabbix integrations (Kafka Connector, SNMP Gateway)
.........T [{ticket_id}] messageThere are multiple Go code repositories separate of main Zabbix mono-repo. Since there is no need to separate changes made by component as it's done for Zabbix main mono-repo, commit messages for the following repositories should be in the format [Ticket-ID] message
Zabbix supports two latest Go versions, so using lowest of the two ensures that we don't introduce changes that build on version N, but don't on version N-1.
go mod tidy before publishing changesMerge can also introduce go.mod and go.sum conflicts (even if git does not consider them conflicts), that break build, hence run go mod tidy after merges.
//nolint:all..golangci.yaml file in the root of a codebase) must be approved by a Go developer//nolint:xxx go directives are allowedLint will always have false positives and cases when the developer knows better. In review the nolint directives should be carefully examined. Confirming that nolint is actually necessary, and the logic cannot be rewritten to adhere to lint rules.
golangci-lint run must have exit code 0.
golangci-lint run --new-from-rev=HEAD~N must have exit code 0 when run on the new commits.
gofmt before publishing changesIdeally set up automatic formatting on save.
Additionally, the following tools can be used to reduce ambiguity even further and ease the development experience. (A really warm suggestion to use all of them.)
gofumpt - a stricter gofmtgolines - splits long linesgoimports - automatically imports used packagesgci - orders package imports deterministicallygotests - unit test generation tool (must have if you have to write unit tests)golangci-lint - lint runnercspell - spell checker, with config "language": "en_US"gotestsum a better go testTo state the obvious - make sure the task is implemented and works.
From Go development process side of things make sure that:
linux and windows platformsgo.sum and go.mod are up-to-dateIf any of the before mentioned checks fail with weird errors running go clean -cache might help.
Also, many Go code repositories might these checks defined as part of a make file, use that.