go snippets2019-08-20 00:00:00 golang检查map是否为空1 2 3 if len(map) == 0 { .... } 时间复杂度: O(1)参考: How to check if a map is empty in Golang?Preappend slice1 2 3 4 5 6 x = append([]int{1}, x...) // 或 x = append(x, 0) copy(x[1:], x) x[0] = 1 参考:How to prepend int to slice