This document outlines the requirements and best practices for contributing code to the Syncthing project. It covers the Developer Certificate of Origin (DCO) requirement, commit message formatting, coding style conventions, testing expectations, and the pull request workflow. Syncthing is a continuous file synchronization program with strict goals regarding data safety and security README.md9-28
All contributions to Syncthing must include a Developer Certificate of Origin sign-off. This certifies that you have the right to submit the code under the project's open source license.
The DCO states that by making a contribution, you certify:
The full text is available at CONTRIBUTING.md88-108
Every commit message must include a Signed-off-by line with your real name and email address:
The name and email must match:
git config user.name and git config user.email).AUTHORS file CONTRIBUTING.md112-121Example Configuration:
Pseudonyms or nicknames are acceptable if you prefer not to use your legal name, but you must be reachable at the provided email address CONTRIBUTING.md70-73
Sources: CONTRIBUTING.md60-121
When your first pull request is accepted, your details are added to the AUTHORS file and the list of authors in the GUI CONTRIBUTING.md62-64 All subsequent commits must use the same name and email as listed in this file CONTRIBUTING.md64-66
Before making your first commit:
AUTHORS file.Sources: CONTRIBUTING.md60-73 CONTRIBUTING.md112-117
Syncthing uses the Conventional Commits specification for commit messages and pull request titles. All subjects must be in lower case CONTRIBUTING.md147-149
Commit Message Structure:
The project uses a strict set of types (e.g., feat, fix, docs, chore, refactor, build) enforced by policy bots .policy.yml32-38
The scope indicates the component affected. This typically corresponds to the part after internal/, lib/, or cmd/ in the package path CONTRIBUTING.md151-155:
gui - Web interface changes.protocol - Block Exchange Protocol.scanner - File scanner.db - Database layer (e.g., internal/db/sqlite).dialer - Connection management.Omit the scope for changes affecting many components or non-code changes like the build system CONTRIBUTING.md155-157
If the commit resolves an existing issue, include (fixes #<number>) at the end of the subject line CONTRIBUTING.md159-161
Example:
feat(dialer): add env var to disable proxy fallback (fixes #3006) CONTRIBUTING.md163
Sources: CONTRIBUTING.md145-168 .policy.yml32-38
Line Endings:
Brace Style:
Code Formatting:
go fmt clean CONTRIBUTING.md140gofumpt for stricter formatting .golangci.yml87Code Guidelines:
Import Grouping:
Imports are grouped per goimports standard: standard library first, then third-party libraries after a blank line CONTRIBUTING.md142-144
golangci-lint)The project uses a comprehensive .golangci.yml configuration. Many linters are enabled by default, while some are explicitly disabled for the Syncthing context (e.g., gochecknoglobals, funlen, cyclop) .golangci.yml4-44
Linter Exclusions:
Sources: CONTRIBUTING.md122-144 .golangci.yml1-97
Add tests when adding features or fixing bugs CONTRIBUTING.md181-182
internal/db/sqlite/db_test.go).test/ directory.Sources: CONTRIBUTING.md179-182 internal/db/typed.go18-53
main using squash merge. The PR title and description become the final commit message CONTRIBUTING.md174-177The project uses policy-bot to enforce merge requirements:
.md files, LICENSE, .policy.yml) .policy.yml42-52trivial label may be accepted on trust if proposed by a contributor .policy.yml92-103Contribution Flow:
Sources: CONTRIBUTING.md43-59 CONTRIBUTING.md169-178 .policy.yml1-114
All code is licensed under the Mozilla Public License Version 2.0 (MPLv2) README.md95 By contributing, you agree to the terms of the MPLv2 LICENSE1-374
When your PR is accepted, your name/email (as configured in git) is added to the AUTHORS file and displayed in the GUI CONTRIBUTING.md62-64
Sources: README.md95 LICENSE1-374 CONTRIBUTING.md60-73
File bugs in the GitHub Issue Tracker CONTRIBUTING.md3-4
Include:
Security Vulnerabilities: Do NOT report these publicly. Email security@syncthing.net README.md72-74
Sources: CONTRIBUTING.md1-23 README.md66-74
Refresh this wiki