github.com/mattn/go@v0.0.0-20171011075504-07f7db3ea99f/test/fixedbugs/issue9083.go (about)

     1  // errorcheck
     2  
     3  // Copyright 2014 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  // Issue 9083: map/chan error messages show non-explicit capacity.
     8  
     9  package main
    10  
    11  // untyped constant
    12  const zero = 0
    13  
    14  func main() {
    15  	var x int
    16  	x = make(map[int]int) // ERROR "cannot use make\(map\[int\]int\)|incompatible"
    17  	x = make(map[int]int, 0) // ERROR "cannot use make\(map\[int\]int, 0\)|incompatible"
    18  	x = make(map[int]int, zero) // ERROR "cannot use make\(map\[int\]int, zero\)|incompatible"
    19  	x = make(chan int) // ERROR "cannot use make\(chan int\)|incompatible"
    20  	x = make(chan int, 0) // ERROR "cannot use make\(chan int, 0\)|incompatible"
    21  	x = make(chan int, zero) // ERROR "cannot use make\(chan int, zero\)|incompatible"
    22  }