// pathf is fmt.Sprintf for generating paths // (on windows it turns / into \ after the printf). func pathf(format string, args ...interface{ … } // filter returns a slice containing the elements x from list for which f(x) == true. func filter(list []string, f func(string) bool) []string { … } // uniq returns a sorted slice containing the unique elements of list. func uniq(list []string) []string { … } const CheckExit … const ShowOutput … const Background … var outputLock … // run is like runEnv with no additional environment. func run(dir string, mode int, cmd ...string) string { … } // runEnv runs the command line cmd in dir with additional environment env. // If mode has ShowOutput set and Background unset, run passes cmd's output to // stdout/stderr directly. Otherwise, run returns cmd's output as a string. // If mode has CheckExit set and the command fails, run calls fatalf. // If mode has Background set, this command is being run as a // Background job. Only bgrun should use the Background mode, // not other callers. func runEnv(dir string, mode int, env []string, cmd ...string) string { … } var maxbg … var bgwork … var bghelpers … var dieOnce … var dying … func bginit() { … } func bghelper() { … } // bgrun is like run but runs the command in the background. // CheckExit|ShowOutput mode is implied (since output cannot be returned). // bgrun adds 1 to wg immediately, and calls Done when the work completes. func bgrun(wg *sync.WaitGroup, dir string, cmd ...string) { … } // bgwait waits for pending bgruns to finish. // bgwait must be called from only a single goroutine at a time. func bgwait(wg *sync.WaitGroup) { … } // xgetwd returns the current directory. func xgetwd() string { … } // xrealwd returns the 'real' name for the given path. // real is defined as what xgetwd returns in that directory. func xrealwd(path string) string { … } // isdir reports whether p names an existing directory. func isdir(p string) bool { … } // isfile reports whether p names an existing file. func isfile(p string) bool { … } // mtime returns the modification time of the file p. func mtime(p string) time.Time { … } // readfile returns the content of the named file. func readfile(file string) string { … } const writeExec … const writeSkipSame … // writefile writes text to the named file, creating it if needed. // if exec is non-zero, marks the file as executable. // If the file already exists and has the expected content, // it is not rewritten, to avoid changing the time stamp. func writefile(text, file string, flag int) { … } // xmkdir creates the directory p. func xmkdir(p string) { … } // xmkdirall creates the directory p and its parents, as needed. func xmkdirall(p string) { … } // xremove removes the file p. func xremove(p string) { … } // xremoveall removes the file or directory tree rooted at p. func xremoveall(p string) { … } // xreaddir replaces dst with a list of the names of the files and subdirectories in dir. // The names are relative to dir; they are not full paths. func xreaddir(dir string) []string { … } // xworkdir creates a new temporary directory to hold object files // and returns the name of that directory. func xworkdir() string { … } // fatalf prints an error message to standard error and exits. func fatalf(format string, args ...interface{ … } var atexits … // xexit exits the process with return code n. func xexit(n int) { … } // xatexit schedules the exit-handler f to be run when the program exits. func xatexit(f func()) { … } // xprintf prints a message to standard output. func xprintf(format string, args ...interface{ … } // errprintf prints a message to standard output. func errprintf(format string, args ...interface{ … } // xsamefile reports whether f1 and f2 are the same file (or dir). func xsamefile(f1, f2 string) bool { … } func xgetgoarm() string { … } // elfIsLittleEndian detects if the ELF file is little endian. func elfIsLittleEndian(fn string) bool { … } type count … func (c *count) String() string { … } func (c *count) Set(s string) error { … } func (c *count) IsBoolFlag() bool { … } func xflagparse(maxargs int) { … }