1 // errorcheck -0 -d=append,slice
3 // Copyright 2015 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
7 // Check optimization results for append and slicing.
11 func a1(x []int, y int) []int {
12 x = append(x, y) // ERROR "append: len-only update \(in local slice\)$"
16 func a2(x []int, y int) []int {
20 func a3(x *[]int, y int) {
21 *x = append(*x, y) // ERROR "append: len-only update$"
24 func s1(x **[]int, xs **string, i, j int) {
26 z = (**x)[0:] // ERROR "slice: omit slice operation$"
30 zs = (**xs)[0:] // ERROR "slice: omit slice operation$"