github.com/yanyiwu/go@v0.0.0-20150106053140-03d6637dbb7f/test/alias.go (about)

     1  // errorcheck
     2  
     3  // Copyright 2011 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  // Test that error messages say what the source file says
     8  // (uint8 vs byte, int32 vs. rune).
     9  // Does not compile.
    10  
    11  package main
    12  
    13  import (
    14  	"fmt"
    15  	"unicode/utf8"
    16  )
    17  
    18  func f(byte)  {}
    19  func g(uint8) {}
    20  
    21  func main() {
    22  	var x float64
    23  	f(x) // ERROR "byte"
    24  	g(x) // ERROR "uint8"
    25  
    26  	// Test across imports.
    27  
    28  	var ff fmt.Formatter
    29  	var fs fmt.State
    30  	ff.Format(fs, x) // ERROR "rune"
    31  
    32  	utf8.RuneStart(x) // ERROR "byte"
    33  }