modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/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  }