Merge pull request #5690 from restic/backend-no-restic-imports

This commit is contained in:
Michael Eischer
2026-01-31 19:13:07 +01:00
committed by GitHub

View File

@@ -6,6 +6,8 @@ linters:
- asciicheck - asciicheck
# ensure that http response bodies are closed # ensure that http response bodies are closed
- bodyclose - bodyclose
# restrict imports from other restic packages for internal/backend (cache exempt)
- depguard
- copyloopvar - copyloopvar
# make sure all errors returned by functions are handled # make sure all errors returned by functions are handled
- errcheck - errcheck
@@ -24,6 +26,20 @@ linters:
# find unused variables, functions, structs, types, etc. # find unused variables, functions, structs, types, etc.
- unused - unused
settings: settings:
depguard:
rules:
# Prevent backend packages from importing the internal/restic package to keep the architectural layers intact.
backend-imports:
files:
- "**/internal/backend/**"
- "!**/internal/backend/cache/**"
- "!**/internal/backend/test/**"
- "!**/*_test.go"
deny:
- pkg: "github.com/restic/restic/internal/restic"
desc: "internal/restic should not be imported to keep the architectural layers intact"
- pkg: "github.com/restic/restic/internal/repository"
desc: "internal/repository should not be imported to keep the architectural layers intact"
importas: importas:
alias: alias:
- pkg: github.com/restic/restic/internal/test - pkg: github.com/restic/restic/internal/test