Skip to content

Commit 0bac3ae

Browse files
authored
sync: update 14 files from source repository (#183)
1 parent a965e2b commit 0bac3ae

14 files changed

Lines changed: 243 additions & 402 deletions

.devcontainer.json

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,39 @@
11
{
2-
"name": "go-sanitize dev container",
3-
"image": "mcr.microsoft.com/devcontainers/go:0-1.24-bullseye",
4-
"features": {
5-
"ghcr.io/devcontainers/features/github-cli:1": {},
6-
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
7-
},
8-
"mounts": [
9-
"type=cache,target=/home/vscode/.cache/go-build",
10-
"type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock"
11-
],
12-
"runArgs": ["--cap-drop=ALL", "--security-opt", "no-new-privileges:true"],
13-
"postCreateCommand": "magex lint && magex vet && magex test",
142
"customizations": {
153
"vscode": {
4+
"extensions": [
5+
"golang.Go",
6+
"github.vscode-github-actions",
7+
"eamodio.gitlens"
8+
],
169
"settings": {
17-
"go.useLanguageServer": true,
10+
"editor.codeActionsOnSave": {
11+
"source.organizeImports": true
12+
},
13+
"editor.formatOnSave": true,
1814
"go.lintTool": "golangci-lint",
1915
"go.toolsEnvVars": {
2016
"GOFLAGS": "-buildvcs=false"
2117
},
22-
"editor.formatOnSave": true,
23-
"editor.codeActionsOnSave": {
24-
"source.organizeImports": true
25-
}
26-
},
27-
"extensions": [
28-
"golang.Go",
29-
"github.vscode-github-actions",
30-
"eamodio.gitlens"
31-
]
18+
"go.useLanguageServer": true
19+
}
3220
}
3321
},
34-
"remoteUser": "vscode"
22+
"features": {
23+
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
24+
"ghcr.io/devcontainers/features/github-cli:1": {}
25+
},
26+
"image": "mcr.microsoft.com/devcontainers/go:0-1.24-bullseye",
27+
"mounts": [
28+
"type=cache,target=/home/vscode/.cache/go-build",
29+
"type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock"
30+
],
31+
"name": "go-sanitize dev container",
32+
"postCreateCommand": "magex lint \u0026\u0026 magex vet \u0026\u0026 magex test",
33+
"remoteUser": "vscode",
34+
"runArgs": [
35+
"--cap-drop=ALL",
36+
"--security-opt",
37+
"no-new-privileges:true"
38+
]
3539
}

.github/.env.base

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ ENABLE_VERBOSE_TEST_OUTPUT=false # Verbose test output (can slow CI)
6969
# Code Quality Tools
7070
ENABLE_GO_LINT=true # Run MAGE-X linter (golangci-lint)
7171
ENABLE_GO_PRE_COMMIT=true # Run go-pre-commit checks
72-
ENABLE_YAML_LINT=true # Validate YAML with prettier
72+
ENABLE_YAML_LINT=true # Validate YAML with yamlfmt (Go-based)
7373

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

223-
# Code Quality Tools
224-
NODE_VERSION=20 # Node.js for prettier and other tools
225-
PRETTIER_VERSION=3.6.2 # https://www.npmjs.com/package/prettier
226-
227223
# ================================================================================================
228224
# 🪄 MAGE-X CONFIGURATION
229225
# ================================================================================================
230226

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

250244
# Runtime variables (set by setup-goreleaser action):
251245
# MAGE_X_GORELEASER_PATH - Path to installed goreleaser binary

.github/.prettierignore

Lines changed: 0 additions & 74 deletions
This file was deleted.

.github/.prettierrc.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/.yamlfmt

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# ------------------------------------------------------------------------------------
2+
# yamlfmt Configuration
3+
#
4+
# Purpose: YAML formatting configuration for the mage-x (yamlfmt) tool
5+
#
6+
# Maintainer: @mrz1836
7+
#
8+
# ------------------------------------------------------------------------------------
9+
10+
formatter:
11+
type: basic
12+
13+
# Indentation settings
14+
indent: 2
15+
16+
# Do not include document start marker (---)
17+
include_document_start: false
18+
19+
# Preserve existing line breaks where sensible
20+
retain_line_breaks: true
21+
22+
# Use LF line endings
23+
line_ending: lf
24+
25+
# Maximum line length (0 = disabled)
26+
max_line_length: 0
27+
28+
# Handle folded strings as literal
29+
scan_folded_as_literal: false
30+
31+
# Keep arrays indented
32+
indentless_arrays: false
33+
34+
# Remove merge tags
35+
drop_merge_tag: false
36+
37+
# Add padding after line comments
38+
pad_line_comments: 1
39+
40+
# File exclusions
41+
exclude:
42+
# Version control and package managers
43+
- "**/.git/**"
44+
- "**/node_modules/**"
45+
- "**/vendor/**"
46+
47+
# Build outputs
48+
- "**/dist/**"
49+
- "**/build/**"
50+
51+
# Coverage artifacts
52+
- "**/coverage/**"
53+
- "**/*.cover"
54+
- "**/*.cov"
55+
- "**/coverage.txt"
56+
- "**/coverage.html"
57+
58+
# Generated code
59+
- "**/*.generated.*"
60+
- "**/*gen.go"
61+
- "**/mock**.go"
62+
- "**/*.pb.go"
63+
- "**/*.pb.gw.go"
64+
- "**/packaged.yaml"
65+
66+
# IDE metadata
67+
- "**/.idea/**"
68+
- "**/.vscode/**"
69+
70+
# Temporary files
71+
- "**/*.tmp"
72+
- "**/*.temp"
73+
- "**/*.swp"
74+
- "**/*.swo"
75+
- "**/*~"
76+
77+
# Build configs
78+
- "**/.env.base"
79+
- "**/.env.custom"

.github/tech-conventions/go-essentials.md

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -385,27 +385,12 @@ platforms.
385385

386386
<br><br>
387387

388-
## 💄 Prettier (YAML Formatting)
388+
## 💄 YAML Formatting
389389

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

392-
**Local Setup:**
393392
```bash
394-
# Install prettier locally
395-
npm init -y && npm install --save-dev prettier
396-
```
397-
398-
**Format YAML files:**
399-
```bash
400-
# Check formatting
401-
npx prettier "**/*.{yml,yaml}" --check --config .github/.prettierrc.yml --ignore-path .github/.prettierignore
402-
403-
# Fix formatting issues
404-
npx prettier "**/*.{yml,yaml}" --write --config .github/.prettierrc.yml --ignore-path .github/.prettierignore
393+
magex format:fix
405394
```
406395

407-
**Configuration Files:**
408-
* [`.github/.prettierrc.yml`](../.prettierrc.yml) - Prettier configuration settings
409-
* [`.github/.prettierignore`](../.prettierignore) - Files and patterns to ignore during formatting
410-
411-
> CI automatically validates YAML formatting using the same prettier configuration. All YAML files must pass formatting checks before merge.
396+
> 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.

0 commit comments

Comments
 (0)