Skip to content

Commit eb765ea

Browse files
mdryaanurunc-bot[bot]
authored andcommitted
fix(unikontainers): lowercase error strings to follow Go conventions
PR: #707 Signed-off-by: Md Raiyan <alikhurshid842001@gmail.com> Reviewed-by: Charalampos Mainas <cmainas@nubificus.co.uk> Approved-by: Charalampos Mainas <cmainas@nubificus.co.uk>
1 parent 0773c40 commit eb765ea

5 files changed

Lines changed: 10 additions & 10 deletions

File tree

pkg/unikontainers/block.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func extractBootFiles(rootfsPath string, newRootfsPath string, unikernel string,
130130
targetUnikernelDir, _ := filepath.Split(targetUnikernelPath)
131131
err := moveFile(currentUnikernelPath, targetUnikernelDir)
132132
if err != nil {
133-
return fmt.Errorf("Could not move %s to %s: %w", currentUnikernelPath, targetUnikernelPath, err)
133+
return fmt.Errorf("could not move %s to %s: %w", currentUnikernelPath, targetUnikernelPath, err)
134134
}
135135

136136
if initrd != "" {
@@ -139,14 +139,14 @@ func extractBootFiles(rootfsPath string, newRootfsPath string, unikernel string,
139139
targetInitrdDir, _ := filepath.Split(targetInitrdPath)
140140
err = moveFile(currentInitrdPath, targetInitrdDir)
141141
if err != nil {
142-
return fmt.Errorf("Could not move %s to %s: %w", currentInitrdPath, targetInitrdPath, err)
142+
return fmt.Errorf("could not move %s to %s: %w", currentInitrdPath, targetInitrdPath, err)
143143
}
144144
}
145145

146146
currentConfigPath := filepath.Join(rootfsPath, uruncJSON)
147147
err = moveFile(currentConfigPath, newRootfsPath)
148148
if err != nil {
149-
return fmt.Errorf("Could not move %s to %s: %w", currentConfigPath, newRootfsPath, err)
149+
return fmt.Errorf("could not move %s to %s: %w", currentConfigPath, newRootfsPath, err)
150150
}
151151

152152
return nil

pkg/unikontainers/mount.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ func fileFromHost(monRootfs string, hostPath string, target string, mFlags int,
220220
flags := mFlags | unix.MS_BIND | unix.MS_REMOUNT
221221
err = unix.Mount(dstPath, dstPath, "", uintptr(flags), "")
222222
if err != nil {
223-
return fmt.Errorf("Failed to set mount flags for %s: %w", dstPath, err)
223+
return fmt.Errorf("failed to set mount flags for %s: %w", dstPath, err)
224224
}
225225
}
226226

@@ -298,7 +298,7 @@ func rootfsParentMountPrivate(path string) error {
298298
path = filepath.Dir(path)
299299
}
300300

301-
return fmt.Errorf("Could not remount as private the parent mount of %s", path)
301+
return fmt.Errorf("could not remount as private the parent mount of %s", path)
302302
}
303303

304304
// prepareRoot prepares the directory of the container's rootfs to safely pivot
@@ -368,7 +368,7 @@ func mountVolumes(rootfsPath string, mounts []specs.Mount) error {
368368
for _, pFlag := range propFlag {
369369
err = unix.Mount(dstPath, dstPath, "", uintptr(pFlag), "")
370370
if err != nil {
371-
return fmt.Errorf("Failed to set propagation flag for %s: %w", m.Source, err)
371+
return fmt.Errorf("failed to set propagation flag for %s: %w", m.Source, err)
372372
}
373373
}
374374
}

pkg/unikontainers/shared_fs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func (s sharedfsRootfs) postSetup() error {
6060
// Get the virtiofsd binary from host in monRootfs
6161
err = fileFromHost(s.monRootfs, s.vfsdConfig.Path, "", unix.MS_BIND|unix.MS_PRIVATE, false)
6262
if err != nil {
63-
return fmt.Errorf("Could not bind mount %s: %w", s.vfsdConfig.Path, err)
63+
return fmt.Errorf("could not bind mount %s: %w", s.vfsdConfig.Path, err)
6464
}
6565
}
6666

pkg/unikontainers/unikernels/rumprun.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (r *Rumprun) CommandString() (string, error) {
7373
}
7474
cmdJSON, err := json.Marshal(cmd)
7575
if err != nil {
76-
return "", fmt.Errorf("Could not Marshal cmdline: %v", err)
76+
return "", fmt.Errorf("could not marshal cmdline: %v", err)
7777
}
7878
cmdJSONString = string(cmdJSON)
7979
for i, eVar := range r.Envs {
@@ -82,7 +82,7 @@ func (r *Rumprun) CommandString() (string, error) {
8282
}
8383
oneVarJSON, err := json.Marshal(eVar)
8484
if err != nil {
85-
return "", fmt.Errorf("Could not Marshal environment variable: %v", err)
85+
return "", fmt.Errorf("could not marshal environment variable: %v", err)
8686
}
8787
if i != 0 {
8888
envJSONString += ","

pkg/unikontainers/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ func findNS(namespaces []specs.LinuxNamespace, nsType specs.LinuxNamespaceType)
259259
}
260260
}
261261

262-
return "", fmt.Errorf("Namespace %s was not found", string(nsType))
262+
return "", fmt.Errorf("namespace %s was not found", string(nsType))
263263
}
264264

265265
// findQemuDataDir tries to find the location of data and BIOS files for Qemu.

0 commit comments

Comments
 (0)