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

     1  // errorcheck
     2  
     3  // Copyright 2017 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  // Check that we don't print duplicate errors for string ->
     8  // array-literal conversion
     9  
    10  package main
    11  
    12  func main() {
    13  	_ = []byte{"foo"}   // ERROR "cannot convert"
    14  	_ = []int{"foo"}    // ERROR "cannot convert"
    15  	_ = []rune{"foo"}   // ERROR "cannot convert"
    16  	_ = []string{"foo"} // OK
    17  }