Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 28 additions & 24 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
{
"name": "go-sanitize dev container",
"image": "mcr.microsoft.com/devcontainers/go:0-1.24-bullseye",
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
},
"mounts": [
"type=cache,target=/home/vscode/.cache/go-build",
"type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock"
],
"runArgs": ["--cap-drop=ALL", "--security-opt", "no-new-privileges:true"],
"postCreateCommand": "magex lint && magex vet && magex test",
"customizations": {
"vscode": {
"extensions": [
"golang.Go",
"github.vscode-github-actions",
"eamodio.gitlens"
],
"settings": {
"go.useLanguageServer": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"editor.formatOnSave": true,
"go.lintTool": "golangci-lint",
"go.toolsEnvVars": {
"GOFLAGS": "-buildvcs=false"
},
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"extensions": [
"golang.Go",
"github.vscode-github-actions",
"eamodio.gitlens"
]
"go.useLanguageServer": true
}
}
},
"remoteUser": "vscode"
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {}
},
"image": "mcr.microsoft.com/devcontainers/go:0-1.24-bullseye",
"mounts": [
"type=cache,target=/home/vscode/.cache/go-build",
"type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock"
],
"name": "go-sanitize dev container",
"postCreateCommand": "magex lint \u0026\u0026 magex vet \u0026\u0026 magex test",
"remoteUser": "vscode",
"runArgs": [
"--cap-drop=ALL",
"--security-opt",
"no-new-privileges:true"
]
}
40 changes: 17 additions & 23 deletions .github/.env.base
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ ENABLE_VERBOSE_TEST_OUTPUT=false # Verbose test output (can slow CI)
# Code Quality Tools
ENABLE_GO_LINT=true # Run MAGE-X linter (golangci-lint)
ENABLE_GO_PRE_COMMIT=true # Run go-pre-commit checks
ENABLE_YAML_LINT=true # Validate YAML with prettier
ENABLE_YAML_LINT=true # Validate YAML with yamlfmt (Go-based)

# Security Scanning
ENABLE_SECURITY_SCAN_GITLEAKS=true # Scan for leaked secrets
Expand Down Expand Up @@ -220,32 +220,26 @@ GITLEAKS_VERSION=8.28.0 # https://github.com/gitleaks/gitleaks/re
GOVULNCHECK_VERSION=v1.1.4 # https://pkg.go.dev/golang.org/x/vuln
NANCY_VERSION=v1.0.51 # https://github.com/sonatype-nexus-community/nancy/releases

# Code Quality Tools
NODE_VERSION=20 # Node.js for prettier and other tools
PRETTIER_VERSION=3.6.2 # https://www.npmjs.com/package/prettier

# ================================================================================================
# 🪄 MAGE-X CONFIGURATION
# ================================================================================================

MAGE_X_VERSION=v1.4.0 # https://github.com/mrz1836/mage-x/releases

# Format exclusion paths (comma-separated directories to exclude from formatting)
MAGE_X_FORMAT_EXCLUDE_PATHS=vendor,node_modules,.git,.idea,.vscode
MAGE_X_AUTO_DISCOVER_BUILD_TAGS=true # Enable auto-discovery of build tags
MAGE_X_AUTO_DISCOVER_BUILD_TAGS_EXCLUDE=race,custom # Comma-separated list of tags to exclude
MAGE_X_GOLANGCI_LINT_VERSION=v2.4.0 # https://github.com/golangci/golangci-lint/releases
MAGE_X_GOFUMPT_VERSION=v0.8.0 # https://github.com/mvdan/gofumpt/releases
MAGE_X_GOVULNCHECK_VERSION=v1.1.4 # https://pkg.go.dev/golang.org/x/vuln
MAGE_X_MOCKGEN_VERSION=v0.6.0 # https://github.com/uber-go/mock/releases
MAGE_X_SWAG_VERSION=v1.16.6 # https://github.com/swaggo/swag/releases
MAGE_X_STATICCHECK_VERSION=2025.1.1 # https://github.com/dominikh/go-tools/releases
MAGE_X_NANCY_VERSION=v1.0.51 # https://github.com/sonatype-nexus-community/nancy/releases
MAGE_X_GITLEAKS_VERSION=8.28.0 # https://github.com/gitleaks/gitleaks/releases
MAGE_X_GORELEASER_VERSION=v2.12.0 # https://github.com/goreleaser/goreleaser/releases
MAGE_X_PRETTIER_VERSION=3.6.2 # https://www.npmjs.com/package/prettier
MAGE_X_GO_VERSION=1.24.x # Primary Go version for MAGE-X (also our primary)
MAGE_X_GO_SECONDARY_VERSION=1.24.x # Secondary Go version for MAGE-X (also our secondary)
MAGE_X_VERSION=v1.6.0 # https://github.com/mrz1836/mage-x/releases
MAGE_X_AUTO_DISCOVER_BUILD_TAGS=true # Enable auto-discovery of build tags
MAGE_X_AUTO_DISCOVER_BUILD_TAGS_EXCLUDE=race,custom # Comma-separated list of tags to exclude
MAGE_X_FORMAT_EXCLUDE_PATHS=vendor,node_modules,.git,.idea # Format exclusion paths (comma-separated directories to exclude from formatting)
MAGE_X_GITLEAKS_VERSION=8.28.0 # https://github.com/gitleaks/gitleaks/releases
MAGE_X_GOFUMPT_VERSION=v0.8.0 # https://github.com/mvdan/gofumpt/releases
MAGE_X_GOLANGCI_LINT_VERSION=v2.4.0 # https://github.com/golangci/golangci-lint/releases
MAGE_X_GORELEASER_VERSION=v2.12.0 # https://github.com/goreleaser/goreleaser/releases
MAGE_X_GOVULNCHECK_VERSION=v1.1.4 # https://pkg.go.dev/golang.org/x/vuln
MAGE_X_GO_SECONDARY_VERSION=1.24.x # Secondary Go version for MAGE-X (also our secondary)
MAGE_X_GO_VERSION=1.24.x # Primary Go version for MAGE-X (also our primary)
MAGE_X_MOCKGEN_VERSION=v0.6.0 # https://github.com/uber-go/mock/releases
MAGE_X_NANCY_VERSION=v1.0.51 # https://github.com/sonatype-nexus-community/nancy/releases
MAGE_X_STATICCHECK_VERSION=2025.1.1 # https://github.com/dominikh/go-tools/releases
MAGE_X_SWAG_VERSION=v1.16.6 # https://github.com/swaggo/swag/releases
MAGE_X_YAMLFMT_VERSION=v0.17.2 # https://github.com/google/yamlfmt/releases

# Runtime variables (set by setup-goreleaser action):
# MAGE_X_GORELEASER_PATH - Path to installed goreleaser binary
Expand Down
74 changes: 0 additions & 74 deletions .github/.prettierignore

This file was deleted.

40 changes: 0 additions & 40 deletions .github/.prettierrc.yml

This file was deleted.

79 changes: 79 additions & 0 deletions .github/.yamlfmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# ------------------------------------------------------------------------------------
# yamlfmt Configuration
#
# Purpose: YAML formatting configuration for the mage-x (yamlfmt) tool
#
# Maintainer: @mrz1836
#
# ------------------------------------------------------------------------------------

formatter:
type: basic

# Indentation settings
indent: 2

# Do not include document start marker (---)
include_document_start: false

# Preserve existing line breaks where sensible
retain_line_breaks: true

# Use LF line endings
line_ending: lf

# Maximum line length (0 = disabled)
max_line_length: 0

# Handle folded strings as literal
scan_folded_as_literal: false

# Keep arrays indented
indentless_arrays: false

# Remove merge tags
drop_merge_tag: false

# Add padding after line comments
pad_line_comments: 1

# File exclusions
exclude:
# Version control and package managers
- "**/.git/**"
- "**/node_modules/**"
- "**/vendor/**"

# Build outputs
- "**/dist/**"
- "**/build/**"

# Coverage artifacts
- "**/coverage/**"
- "**/*.cover"
- "**/*.cov"
- "**/coverage.txt"
- "**/coverage.html"

# Generated code
- "**/*.generated.*"
- "**/*gen.go"
- "**/mock**.go"
- "**/*.pb.go"
- "**/*.pb.gw.go"
- "**/packaged.yaml"

# IDE metadata
- "**/.idea/**"
- "**/.vscode/**"

# Temporary files
- "**/*.tmp"
- "**/*.temp"
- "**/*.swp"
- "**/*.swo"
- "**/*~"

# Build configs
- "**/.env.base"
- "**/.env.custom"
23 changes: 4 additions & 19 deletions .github/tech-conventions/go-essentials.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,27 +385,12 @@ platforms.

<br><br>

## 💄 Prettier (YAML Formatting)
## 💄 YAML Formatting

YAML files must be formatted consistently using Prettier to ensure clean diffs and readable configuration files.
YAML files must be formatted consistently to ensure clean diffs and readable configuration files.

**Local Setup:**
```bash
# Install prettier locally
npm init -y && npm install --save-dev prettier
```

**Format YAML files:**
```bash
# Check formatting
npx prettier "**/*.{yml,yaml}" --check --config .github/.prettierrc.yml --ignore-path .github/.prettierignore

# Fix formatting issues
npx prettier "**/*.{yml,yaml}" --write --config .github/.prettierrc.yml --ignore-path .github/.prettierignore
magex format:fix
```

**Configuration Files:**
* [`.github/.prettierrc.yml`](../.prettierrc.yml) - Prettier configuration settings
* [`.github/.prettierignore`](../.prettierignore) - Files and patterns to ignore during formatting

> CI automatically validates YAML formatting using the same prettier configuration. All YAML files must pass formatting checks before merge.
> The `magex format:fix` command handles YAML formatting (via yamlfmt) along with Go, JSON, and other file types. CI automatically validates formatting using the same tools.
Loading