type importReader … func isIdent(c byte) bool { … } var errSyntax … var errNUL … // syntaxError records a syntax error, but only if an I/O error has not already been recorded. func (r *importReader) syntaxError() { … } // readByte reads the next byte from the input, saves it in buf, and returns it. // If an error occurs, readByte records the error in r.err and returns 0. func (r *importReader) readByte() byte { … } // peekByte returns the next byte from the input reader but does not advance beyond it. // If skipSpace is set, peekByte skips leading spaces and comments. func (r *importReader) peekByte(skipSpace bool) byte { … } // nextByte is like peekByte but advances beyond the returned byte. func (r *importReader) nextByte(skipSpace bool) byte { … } // readKeyword reads the given keyword from the input. // If the keyword is not present, readKeyword records a syntax error. func (r *importReader) readKeyword(kw string) { … } // readIdent reads an identifier from the input. // If an identifier is not present, readIdent records a syntax error. func (r *importReader) readIdent() { … } // readString reads a quoted string literal from the input. // If an identifier is not present, readString records a syntax error. func (r *importReader) readString(save *[]string) { … } // readImport reads an import clause - optional identifier followed by quoted string - // from the input. func (r *importReader) readImport(imports *[]string) { … } // readComments is like ioutil.ReadAll, except that it only reads the leading // block of comments in the file. func readComments(f io.Reader) ([]byte, error) { … } // readimports returns the imports found in the named file. func readimports(file string) []string { … } // resolveVendor returns a unique package path imported with the given import // path from srcDir. // // resolveVendor assumes that a package is vendored if and only if its first // path component contains a dot. If a package is vendored, its import path // is returned with a "vendor" or "cmd/vendor" prefix, depending on srcDir. // Otherwise, the import path is returned verbatim. func resolveVendor(imp, srcDir string) string { … }