// moduleWalkErr returns filepath.SkipDir if the directory isn't relevant // when indexing a module or generating a filehash, ErrNotIndexed, // if the module shouldn't be indexed, and nil otherwise. func moduleWalkErr(root string, path string, info fs.FileInfo, err error) error { … } // indexModule indexes the module at the given directory and returns its // encoded representation. It returns ErrNotIndexed if the module can't // be indexed because it contains symlinks. func indexModule(modroot string) ([]byte, error) { … } // indexPackage indexes the package at the given directory and returns its // encoded representation. It returns ErrNotIndexed if the package can't // be indexed. func indexPackage(modroot, pkgdir string) []byte { … } type rawPackage … type parseError … // parseErrorToString converts the error from parsing the file into a string // representation. A nil error is converted to an empty string, and all other // errors are converted to a JSON-marshaled parseError struct, with ErrorList // set for errors of type scanner.ErrorList, and ErrorString set to the error's // string representation for all other errors. func parseErrorToString(err error) string { … } // parseErrorFromString converts a string produced by parseErrorToString back // to an error. An empty string is converted to a nil error, and all // other strings are expected to be JSON-marshaled parseError structs. // The two functions are meant to preserve the structure of an // error of type scanner.ErrorList in a round trip, but may not preserve the // structure of other errors. func parseErrorFromString(s string) error { … } type rawFile … type rawImport … type embed … // importRaw fills the rawPackage from the package files in srcDir. // dir is the package's path relative to the modroot. func importRaw(modroot, reldir string) *rawPackage { … } // extractCgoDirectives filters only the lines containing #cgo directives from the input, // which is the comment on import "C". func extractCgoDirectives(doc string) []string { … }