code: func readImports(f io.Reader, reportSyntaxError bool) ([]byte, error) {
  	r := &importReader{b: bufio.NewReader(f)}
  
  	r.readKeyword("package")
  	r.readIdent()
  	for r.peekByte(true) == 'i' {
  		r.readKeyword("import")
  		if r.peekByte(true) == '(' {
  			r.nextByte(false)
  			for r.peekByte(true) != ')' && r.err == nil {
  				r.readImport()
  			}
  			r.nextByte(false)
  		} else {
  			r.readImport()
  		}
  	}
  
  	// If we stopped successfully before EOF, we read a byte that told us we were done.
  	// Return all but that last byte, which would cause a syntax error if we let it through.
  	if r.err == nil && !r.eof {
  		return r.buf[:len(r.buf)-1], nil
  	}
  
  	// If we stopped for a syntax error, consume the whole file so that
  	// we are sure we don't change the errors that go/parser returns.
  	if r.err == errSyntax && !reportSyntaxError {
  		r.err = nil
  		for r.err == nil && !r.eof {
  			r.readByte()
  		}
  	}
  
  	return r.buf, r.err
  }
docs: // readImports is like ioutil.ReadAll, except that it expects a Go file as input
  // and stops reading the input once the imports have completed.