const usageMessage … func usage() { … } func main() { … } var op … var verbose … // setOp parses the operation string (first argument). func setOp(arg string) { … } const arHeader … type Archive … // archive opens (and if necessary creates) the named archive. func openArchive(name string, mode int, files []string) *Archive { … } // scan scans the archive and executes the specified action on each entry. func (ar *Archive) scan(action func(*archive.Entry)) { … } // listEntry prints to standard output a line describing the entry. func listEntry(e *archive.Entry, verbose bool) { … } // output copies the entry to the specified writer. func (ar *Archive) output(e *archive.Entry, w io.Writer) { … } // match reports whether the entry matches the argument list. // If it does, it also drops the file from the to-be-processed list. func (ar *Archive) match(e *archive.Entry) bool { … } // addFiles adds files to the archive. The archive is known to be // sane and we are positioned at the end. No attempt is made // to check for existing files. func (ar *Archive) addFiles() { … } type FileLike … // addFile adds a single file to the archive func (ar *Archive) addFile(fd FileLike) { … } // addPkgdef adds the __.PKGDEF file to the archive, copied // from the first Go object file on the file list, if any. // The archive is known to be empty. func (ar *Archive) addPkgdef() { … } var stdout … // printContents implements the 'p' command. func (ar *Archive) printContents(e *archive.Entry) { … } // tableOfContents implements the 't' command. func (ar *Archive) tableOfContents(e *archive.Entry) { … } // extractContents implements the 'x' command. func (ar *Archive) extractContents(e *archive.Entry) { … } func (ar *Archive) extractContents1(e *archive.Entry, out io.Writer) { … } // isGoCompilerObjFile reports whether file is an object file created // by the Go compiler, which is an archive file with exactly one entry // of __.PKGDEF, or _go_.o, or both entries. func isGoCompilerObjFile(a *archive.Archive) bool { … }