...
Run Format

Source file test/fixedbugs/issue10925.go

Documentation: test/fixedbugs

     1  // run
     2  
     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.
     6  
     7  package main
     8  
     9  import "fmt"
    10  
    11  func prototype(xyz []string) {}
    12  func main() {
    13  	var got [][]string
    14  	f := prototype
    15  	f = func(ss []string) { got = append(got, ss) }
    16  	for _, s := range []string{"one", "two", "three"} {
    17  		f([]string{s})
    18  	}
    19  	if got[0][0] != "one" || got[1][0] != "two" || got[2][0] != "three" {
    20  		// Bug's wrong output was [[three] [three] [three]]
    21  		fmt.Println("Expected [[one] [two] [three]], got", got)
    22  	}
    23  }
    24  

View as plain text