Compare commits

...

2 Commits

Author SHA1 Message Date
7e2b50faf0 update .vscode settings 2026-04-08 19:31:36 +00:00
9ea29d3ba4 rename.sh: keep gitea.djmil.dev/go/template/pkg/result 2026-04-08 19:14:41 +00:00
4 changed files with 20 additions and 20 deletions

View File

@ -54,7 +54,7 @@
"mounts": [
"source=${localEnv:HOME}/.claude,target=/home/vscode/.claude,type=bind,consistency=cached"
],
// Forward the default HTTP port so `make run` is reachable from the host.
"forwardPorts": [8080],

View File

@ -1,12 +1,10 @@
{
// Go
"go.useLanguageServer": true,
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--fast"],
"go.lintOnSave": "workspace",
"go.testFlags": ["-race"],
"go.coverOnSave": false,
"go.generateOnSave": false,
// Editor
"[go]": {
@ -16,9 +14,6 @@
"source.organizeImports": "explicit"
}
},
"[yaml]": {
"editor.defaultFormatter": "redhat.vscode-yaml"
},
// Files
"files.exclude": {
@ -27,16 +22,15 @@
},
"search.exclude": {
"**/bin": true,
"**/mocks": true,
"**/vendor": true
},
// Test explorer
"go.testExplorer.enable": true,
"makefile.configureOnOpen": false,
"cSpell.words": [
"djmil",
"gitea",
"golangci",
"testutil"
]
}

7
.vscode/tasks.json vendored
View File

@ -41,13 +41,6 @@
"presentation": { "reveal": "always", "panel": "shared" },
"problemMatcher": "$go"
},
{
"label": "mocks",
"type": "shell",
"command": "make mocks",
"group": "none",
"presentation": { "reveal": "always", "panel": "shared" }
},
{
"label": "security scan",
"type": "shell",

View File

@ -126,11 +126,24 @@ sedi() {
fi
}
# ── Helper: rename module path in a file, preserving pkg/result imports ───────
# pkg/result is a standalone publishable package; its import path must not
# change when the consuming project is renamed.
RESULT_PKG="${OLD_MODULE}/pkg/result"
PLACEHOLDER="__RESULT_PKG_PLACEHOLDER__"
rename_module_in() {
local file="$1"
sedi "s|${RESULT_PKG}|${PLACEHOLDER}|g" "$file"
sedi "s|${OLD_MODULE}|${NEW_MODULE}|g" "$file"
sedi "s|${PLACEHOLDER}|${RESULT_PKG}|g" "$file"
}
# ── Apply substitutions ───────────────────────────────────────────────────────
heading "Applying changes"
# 1. go.mod — module declaration
sedi "s|${OLD_MODULE}|${NEW_MODULE}|g" go.mod
rename_module_in go.mod
info "go.mod"
# 2. All Go source files — import paths
@ -143,7 +156,7 @@ GO_FILES=$(find . \
CHANGED_GO=0
for f in $GO_FILES; do
if grep -q "$OLD_MODULE" "$f" 2>/dev/null; then
sedi "s|${OLD_MODULE}|${NEW_MODULE}|g" "$f"
rename_module_in "$f"
CHANGED_GO=$((CHANGED_GO + 1))
fi
done
@ -159,19 +172,19 @@ fi
# 4. README.md — heading + all module path occurrences
if [[ -f README.md ]]; then
sedi "s|^# ${OLD_PROJECT}$|# ${NEW_PROJECT}|g" README.md
sedi "s|${OLD_MODULE}|${NEW_MODULE}|g" README.md
rename_module_in README.md
info "README.md"
fi
# 5. CLAUDE.md — Module line
if [[ -f CLAUDE.md ]]; then
sedi "s|${OLD_MODULE}|${NEW_MODULE}|g" CLAUDE.md
rename_module_in CLAUDE.md
info "CLAUDE.md"
fi
# 6. .golangci.yml — goimports local-prefixes
if [[ -f .golangci.yml ]]; then
sedi "s|${OLD_MODULE}|${NEW_MODULE}|g" .golangci.yml
rename_module_in .golangci.yml
info ".golangci.yml"
fi