mirror of
https://github.com/outbackdingo/debos.git
synced 2026-01-27 10:18:47 +00:00
Enabled additional linters from fakemachine configuration: - errorlint: Error wrapping with %w - misspell: Spelling checks - revive: Code quality checks - whitespace: Formatting checks Fixed all issues including: - Error handling: Added proper error checks for all function returns - Error wrapping: Changed %v to %w for proper error wrapping - Type assertions: Used errors.As instead of direct type assertions - Unused parameters: Renamed to underscore where appropriate - Variable naming: Fixed ALL_CAPS constants and underscored names - Whitespace: Removed unnecessary leading/trailing newlines - Code flow: Removed unnecessary else blocks Renamed types (breaking internal API changes): - DebosState → State - DebosContext → Context - DownloadHttpUrl → DownloadHTTPURL Fixed struct field naming with proper YAML tags: - Url → URL (with yaml:"url" tag) - TlsClientCertPath → TLSClientCertPath (kept yaml:"tls-client-cert-path") - TlsClientKeyPath → TLSClientKeyPath (kept yaml:"tls-client-key-path") - validateUrl → validateURL method Co-authored-by: sjoerdsimons <22603932+sjoerdsimons@users.noreply.github.com>
31 lines
568 B
Go
31 lines
568 B
Go
package debos
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
)
|
|
|
|
/*
|
|
DebugShell function launches an interactive shell for
|
|
debug and problems investigation.
|
|
*/
|
|
func DebugShell(context Context) {
|
|
if len(context.DebugShell) == 0 {
|
|
return
|
|
}
|
|
|
|
pa := os.ProcAttr{
|
|
Files: []*os.File{os.Stdin, os.Stdout, os.Stderr},
|
|
Dir: context.Scratchdir,
|
|
}
|
|
|
|
// Start an interactive shell for debug.
|
|
log.Printf(">>> Starting a debug shell")
|
|
if proc, err := os.StartProcess(context.DebugShell, []string{}, &pa); err != nil {
|
|
fmt.Printf("Failed: %s\n", err)
|
|
} else {
|
|
_, _ = proc.Wait()
|
|
}
|
|
}
|