modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/issue7223.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  package main
     8  
     9  var bits1 uint = 10
    10  const bits2 uint = 10
    11  
    12  func main() {
    13  	_ = make([]byte, 1<<bits1)
    14  	_ = make([]byte, 1<<bits2)
    15  	_ = make([]byte, nil) // ERROR "non-integer.*len"
    16  	_ = make([]byte, nil, 2) // ERROR "non-integer.*len"
    17  	_ = make([]byte, 1, nil) // ERROR "non-integer.*cap"
    18  	_ = make([]byte, true) // ERROR "non-integer.*len"
    19  	_ = make([]byte, "abc") // ERROR "non-integer.*len"
    20  }