github.com/huandu/go@v0.0.0-20151114150818-04e615e41150/test/fixedbugs/bug345.dir/main.go (about)

     1  // Copyright 2011 The Go Authors.  All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  import (
     8  	"bufio"
     9  	"./io"
    10  	goio "io"
    11  )
    12  
    13  func main() {
    14  	// The errors here complain that io.X != io.X
    15  	// for different values of io so they should be
    16  	// showing the full import path, which for the
    17  	// "./io" import is really ..../go/test/io.
    18  	// For example:
    19  	//
    20  	// main.go:25: cannot use w (type "/Users/rsc/g/go/test/fixedbugs/bug345.dir/io".Writer) as type "io".Writer in function argument:
    21  	//	io.Writer does not implement io.Writer (missing Write method)
    22  	// main.go:27: cannot use &x (type *"io".SectionReader) as type *"/Users/rsc/g/go/test/fixedbugs/bug345.dir/io".SectionReader in function argument
    23  
    24  	var w io.Writer
    25  	bufio.NewWriter(w)  // ERROR "test/io|has incompatible type"
    26  	var x goio.SectionReader
    27  	io.SR(&x)  // ERROR "test/io|has incompatible type"
    28  }