func init() { … } var _ … var counterErrorsGOPATHEntryRelative … func main() { … } // cmdIsGoTelemeteryOff reports whether the command is "go telemetry off". This // is used to decide whether to disable the opening of counter files. See #69269. func cmdIsGoTelemetryOff() bool { … } // lookupCmd interprets the initial elements of args // to find a command to run (cmd.Runnable() == true) // or else a command group that ran out of arguments // or had an unknown subcommand (len(cmd.Commands) > 0). // It returns that command and the number of elements of args // that it took to arrive at that command. func lookupCmd(args []string) (cmd *base.Command, used int) { … } func invoke(cmd *base.Command, args []string) { … } func init() { … } func mainUsage() { … } func maybeStartTrace(pctx context.Context) context.Context { … } // handleChdirFlag handles the -C flag before doing anything else. // The -C flag must be the first flag on the command line, to make it easy to find // even with commands that have custom flag parsing. // handleChdirFlag handles the flag by chdir'ing to the directory // and then removing that flag from the command line entirely. // // We have to handle the -C flag this way for two reasons: // // 1. Toolchain selection needs to be in the right directory to look for go.mod and go.work. // // 2. A toolchain switch later on reinvokes the new go command with the same arguments. // The parent toolchain has already done the chdir; the child must not try to do it again. func handleChdirFlag() { … }