Pass full slice range as parameter
问题 Considering the code below, I have seen some code using this format v[:] for pass full slice (not part of it) as parameter. Is there any difference between v[:] and v ? Or it is just a developer preference? The test I did below show me no difference. Am I missing something? package main import ( "fmt" ) func main() { v := []byte {1, 2, 3} printSliceInfo(v) printSliceInfo(v[:]) } func printSliceInfo(s []byte) { fmt.Printf("Len: %v - Cap: %v - %v\n", len(s), cap(s), s) } 回答1: When v is a slice,