From d03e32cee0f5e0c87a2f0e0cfe9eef6a0a195da9 Mon Sep 17 00:00:00 2001 From: vinayakjeet Date: Tue, 17 Feb 2026 09:26:28 +0530 Subject: [PATCH] fix: correct typos and handle swallowed json.Marshal error - Fix typo 'remobe' -> 'remove' in rootfs.go error message - Fix typo 'socker' -> 'socket' in create.go error message - Replace 'runc' with 'urunc' in user-facing strings - Handle swallowed json.Marshal error in firecracker.go Signed-off-by: vinayakjeet --- cmd/urunc/create.go | 2 +- cmd/urunc/delete.go | 4 ++-- cmd/urunc/main.go | 2 +- cmd/urunc/run.go | 2 +- pkg/unikontainers/hypervisors/firecracker.go | 7 +++++-- pkg/unikontainers/rootfs.go | 2 +- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/cmd/urunc/create.go b/cmd/urunc/create.go index 3c682b81..0124a755 100644 --- a/cmd/urunc/create.go +++ b/cmd/urunc/create.go @@ -183,7 +183,7 @@ func createUnikontainer(cmd *cli.Command, uruncCfg *unikontainers.UruncConfig) ( consoleSocket := cmd.String("console-socket") conn, err := net.Dial("unix", consoleSocket) if err != nil { - err = fmt.Errorf("failed to dial console socker: %w", err) + err = fmt.Errorf("failed to dial console socket: %w", err) return err } defer conn.Close() diff --git a/cmd/urunc/delete.go b/cmd/urunc/delete.go index 41eeeac6..7ba25ec0 100644 --- a/cmd/urunc/delete.go +++ b/cmd/urunc/delete.go @@ -33,9 +33,9 @@ var deleteCommand = &cli.Command{ Where "" is the name for the instance of the container. EXAMPLE: -For example, if the container id is "ubuntu01" and runc list currently shows the +For example, if the container id is "ubuntu01" and urunc list currently shows the status of "ubuntu01" as "stopped" the following will delete resources held for -"ubuntu01" removing "ubuntu01" from the runc list of containers: +"ubuntu01" removing "ubuntu01" from the urunc list of containers: # urunc delete ubuntu01`, Flags: []cli.Flag{ diff --git a/cmd/urunc/main.go b/cmd/urunc/main.go index a5e9cdde..ffa27e72 100644 --- a/cmd/urunc/main.go +++ b/cmd/urunc/main.go @@ -86,7 +86,7 @@ func main() { &cli.StringFlag{ Name: "log", Value: "", - Usage: "set the log file to write runc logs to (default is '/dev/stderr')", + Usage: "set the log file to write urunc logs to (default is '/dev/stderr')", }, &cli.StringFlag{ Name: "log-format", diff --git a/cmd/urunc/run.go b/cmd/urunc/run.go index 6774f834..345f5728 100644 --- a/cmd/urunc/run.go +++ b/cmd/urunc/run.go @@ -36,7 +36,7 @@ filesystem. The specification file includes an args parameter. The args parameter is used to specify command(s) that get run when the container is started. To change the command(s) that get executed on start, edit the args parameter of the spec. See -"runc spec --help" for more explanation.` +"urunc spec --help" for more explanation.` var runCommand = &cli.Command{ Name: "run", diff --git a/pkg/unikontainers/hypervisors/firecracker.go b/pkg/unikontainers/hypervisors/firecracker.go index 2787a813..fc739136 100644 --- a/pkg/unikontainers/hypervisors/firecracker.go +++ b/pkg/unikontainers/hypervisors/firecracker.go @@ -186,8 +186,11 @@ func (fc *Firecracker) BuildExecCmd(args types.ExecArgs, ukernel types.Unikernel NetIfs: FCNet, VSock: FCVSockDev, } - FCConfigJSON, _ := json.Marshal(FCConfig) - if err := os.WriteFile(JSONConfigFile, FCConfigJSON, 0o644); err != nil { //nolint: gosec + FCConfigJSON, err := json.Marshal(FCConfig) + if err != nil { + return nil, fmt.Errorf("failed to marshal Firecracker config: %w", err) + } + if err = os.WriteFile(JSONConfigFile, FCConfigJSON, 0o644); err != nil { //nolint: gosec return nil, fmt.Errorf("failed to save Firecracker json config: %w", err) } vmmLog.WithField("Json", string(FCConfigJSON)).Debug("Firecracker json config") diff --git a/pkg/unikontainers/rootfs.go b/pkg/unikontainers/rootfs.go index 08e9fa5d..797f0cb6 100644 --- a/pkg/unikontainers/rootfs.go +++ b/pkg/unikontainers/rootfs.go @@ -274,7 +274,7 @@ func pivotRootfs(newRoot string) error { // We no longer need the old rootfs err = os.RemoveAll("old_root") if err != nil { - return fmt.Errorf("failed to remobe old_root: %w", err) + return fmt.Errorf("failed to remove old_root: %w", err) } return nil