Skip Files
Overview
Section titled “Overview”The skip_files section in boilerplate.yml lets you conditionally exclude files from the output. This is useful for
optional features like Docker support, test files, or platform-specific configuration.
Syntax
Section titled “Syntax”Skip by path (exclude files)
Section titled “Skip by path (exclude files)”skip_files: - path: "Dockerfile" if: "{{ not .IncludeDocker }}"
- path: "*.test.go" if: "{{ not .IncludeTests }}"When if evaluates to true, the matching files are skipped (excluded from output).
Skip by not_path (include only specific files)
Section titled “Skip by not_path (include only specific files)”skip_files: - not_path: "*.go" if: trueWhen using not_path, all files that do not match the pattern are skipped.
Glob Patterns
Section titled “Glob Patterns”Both path and not_path support glob patterns:
| Pattern | Matches |
|---|---|
Dockerfile | Exact filename |
*.test.go | All files ending in .test.go |
configs/* | All files directly inside configs/ |
**/*.yaml | All .yaml files in any subdirectory |
Conditional Expressions
Section titled “Conditional Expressions”The if field uses Go template syntax and can access all template variables:
skip_files: # Skip if not production - path: "monitoring/*" if: '{{ ne .Environment "production" }}'
# Always skip - path: ".gitkeep" if: "true"
# Skip based on multiple conditions - path: "docker-compose.yml" if: "{{ or (not .IncludeDocker) .UseKubernetes }}"Unconditional Skip
Section titled “Unconditional Skip”To always skip certain files, set if to the string "true":
skip_files: - path: "boilerplate.yml" if: "true"