Add lint targets, fix gofmt drift, broaden Makefile build inputs

Three small operational improvements.

1. Makefile build dependencies now cover everything under cmd/ and
   internal/, not just *.go. The previous GO_SOURCES find pattern
   missed embedded assets (catalog.json today, anything else added
   later), so editing a JSON manifest didn't trigger a rebuild and
   left the binary stale. New BUILD_INPUTS covers all files; go's own
   build cache absorbs any redundant invocations. GO_SOURCES is kept
   for fmt/lint targets which still want only Go files.

2. New `make lint` (default + lint-go + lint-shell):
   - lint-go: gofmt -l (fail if any output) and go vet ./...
   - lint-shell: shellcheck --severity=error on scripts/*.sh
   The shell floor is set at error-level for now; the legacy
   make-rootfs-*.sh / make-*-kernel.sh / customize.sh scripts have
   warning-level findings (sudo-cat redirects, heredoc quoting) that
   would block landing this if we tightened immediately. Documented
   as tech debt in docs/kernel-catalog.md alongside a note about
   eventually replacing the per-distro bash with a uniform Go tool.

3. gofmt drift fixed in internal/daemon/imagemgr/build.go,
   session/session.go, and vm_create_ops.go (trailing newline +
   gofmt's preferred function-definition wrapping). Now
   `make lint` passes cleanly; future drift will fail CI/local lint
   instead of accumulating.

AGENTS.md gains a one-line note on make lint.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Thales Maciel 2026-04-16 16:49:17 -03:00
parent f0c1dc924c
commit da4a6bf45b
No known key found for this signature in database
GPG key ID: 33112E6833C34679
6 changed files with 76 additions and 19 deletions

View file

@ -245,4 +245,3 @@ func shellArray(values []string) string {
func shellQuote(value string) string {
return "'" + strings.ReplaceAll(value, "'", `'"'"'`) + "'"
}

View file

@ -53,16 +53,28 @@ func RelativeStateDir(id string) string {
return strings.TrimPrefix(StateDir(id), "/root/")
}
func ScriptPath(id string) string { return filepath.ToSlash(filepath.Join(StateDir(id), "run.sh")) }
func PIDPath(id string) string { return filepath.ToSlash(filepath.Join(StateDir(id), "pid")) }
func MonitorPIDPath(id string) string { return filepath.ToSlash(filepath.Join(StateDir(id), "monitor_pid")) }
func ExitCodePath(id string) string { return filepath.ToSlash(filepath.Join(StateDir(id), "exit_code")) }
func StdinPipePath(id string) string { return filepath.ToSlash(filepath.Join(StateDir(id), "stdin.pipe")) }
func StdinKeepalivePIDPath(id string) string { return filepath.ToSlash(filepath.Join(StateDir(id), "stdin_keepalive.pid")) }
func StatusPath(id string) string { return filepath.ToSlash(filepath.Join(StateDir(id), "status")) }
func ErrorPath(id string) string { return filepath.ToSlash(filepath.Join(StateDir(id), "error")) }
func StdoutLogPath(id string) string { return filepath.ToSlash(filepath.Join(StateDir(id), "stdout.log")) }
func StderrLogPath(id string) string { return filepath.ToSlash(filepath.Join(StateDir(id), "stderr.log")) }
func ScriptPath(id string) string { return filepath.ToSlash(filepath.Join(StateDir(id), "run.sh")) }
func PIDPath(id string) string { return filepath.ToSlash(filepath.Join(StateDir(id), "pid")) }
func MonitorPIDPath(id string) string {
return filepath.ToSlash(filepath.Join(StateDir(id), "monitor_pid"))
}
func ExitCodePath(id string) string {
return filepath.ToSlash(filepath.Join(StateDir(id), "exit_code"))
}
func StdinPipePath(id string) string {
return filepath.ToSlash(filepath.Join(StateDir(id), "stdin.pipe"))
}
func StdinKeepalivePIDPath(id string) string {
return filepath.ToSlash(filepath.Join(StateDir(id), "stdin_keepalive.pid"))
}
func StatusPath(id string) string { return filepath.ToSlash(filepath.Join(StateDir(id), "status")) }
func ErrorPath(id string) string { return filepath.ToSlash(filepath.Join(StateDir(id), "error")) }
func StdoutLogPath(id string) string {
return filepath.ToSlash(filepath.Join(StateDir(id), "stdout.log"))
}
func StderrLogPath(id string) string {
return filepath.ToSlash(filepath.Join(StateDir(id), "stderr.log"))
}
// -- Script generators ------------------------------------------------------

View file

@ -11,10 +11,10 @@ import (
"banger/internal/model"
)
func (op *vmCreateOperationState) ID() string { return op.snapshot().ID }
func (op *vmCreateOperationState) IsDone() bool { return op.snapshot().Done }
func (op *vmCreateOperationState) UpdatedAt() time.Time { return op.snapshot().UpdatedAt }
func (op *vmCreateOperationState) Cancel() { op.cancelOperation() }
func (op *vmCreateOperationState) ID() string { return op.snapshot().ID }
func (op *vmCreateOperationState) IsDone() bool { return op.snapshot().Done }
func (op *vmCreateOperationState) UpdatedAt() time.Time { return op.snapshot().UpdatedAt }
func (op *vmCreateOperationState) Cancel() { op.cancelOperation() }
type vmCreateProgressKey struct{}