Explorar o código

console: prefer nil slices over zero-length slices (#19076)

Matthew Halpern %!s(int64=6) %!d(string=hai) anos
pai
achega
e26a119c9b
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      console/console.go

+ 1 - 1
console/console.go

@@ -236,7 +236,7 @@ func (c *Console) clearHistory() {
 // consoleOutput is an override for the console.log and console.error methods to
 // stream the output into the configured output stream instead of stdout.
 func (c *Console) consoleOutput(call otto.FunctionCall) otto.Value {
-	output := []string{}
+	var output []string
 	for _, argument := range call.ArgumentList {
 		output = append(output, fmt.Sprintf("%v", argument))
 	}