...
Run Format

Source file test/fixedbugs/bug353.go

Documentation: test/fixedbugs

     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  // issue 2089 - internal compiler error
     8  
     9  package main
    10  
    11  import (
    12  	"io"
    13  	"os"
    14  )
    15  
    16  func echo(fd io.ReadWriterCloser) { // ERROR "undefined.*io.ReadWriterCloser"
    17  	var buf [1024]byte
    18  	for {
    19  		n, err := fd.Read(buf)
    20  		if err != nil {
    21  			break
    22  		}
    23  		fd.Write(buf[0:n])
    24  	}
    25  }
    26  
    27  func main() {
    28  	fd, _ := os.Open("a.txt")
    29  	echo(fd)
    30  }
    31  

View as plain text