Source file test/fixedbugs/issue15992.go

     1  // run
     2  
     3  // Copyright 2018 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 (
    10  	"fmt"
    11  )
    12  
    13  func f(a []byte) ([]byte, []byte) {
    14  	return a, []byte("abc")
    15  }
    16  
    17  func g(a []byte) ([]byte, string) {
    18  	return a, "abc"
    19  }
    20  
    21  func h(m map[int]int) (map[int]int, int) {
    22  	return m, 0
    23  }
    24  
    25  func main() {
    26  	a := []byte{1, 2, 3}
    27  	n := copy(f(a))
    28  	fmt.Println(n, a)
    29  
    30  	b := []byte{1, 2, 3}
    31  	n = copy(g(b))
    32  	fmt.Println(n, b)
    33  
    34  	m := map[int]int{0: 0}
    35  	fmt.Println(len(m))
    36  	delete(h(m))
    37  	fmt.Println(len(m))
    38  }
    39  

View as plain text