Prefer nil empty slices

Signed-off-by: David Gageot <david.gageot@docker.com>
This commit is contained in:
David Gageot
2022-10-07 20:40:04 +02:00
parent ebb5ded10b
commit 810c3e788f
4 changed files with 6 additions and 6 deletions

View File

@@ -80,7 +80,7 @@ func mkdir(path string, perm os.FileMode) {
// list of all enabled cgroups
func cgroupList() []string {
list := []string{}
var list []string
f, err := os.Open("/proc/cgroups")
if err != nil {
log.Printf("cannot open /proc/cgroups: %v", err)
@@ -125,7 +125,7 @@ func read(path string) string {
// read a directory
func readdir(path string) []string {
names := []string{}
var names []string
files, err := os.ReadDir(path)
if err != nil {
log.Printf("cannot read directory %s: %v", path, err)

View File

@@ -85,7 +85,7 @@ func systemInitCmd(ctx context.Context, args []string) {
_ = os.Remove(*sock)
// look for containerd options
ctrdArgs := []string{}
var ctrdArgs []string
var (
stderr io.Writer = os.Stderr
stdout io.Writer = os.Stdout