type VersionHeader … type DocumentURI … type Position … type Range … type Location … type DiagnosticRelatedInformation … type DiagnosticSeverity … const SeverityInformation … type DiagnosticTag … type Diagnostic … type LoggedOpt … type logFormat … const None … const Json0 … var Format … var dest … // LogJsonOption parses and validates the version,directory value attached to the -json compiler flag. func LogJsonOption(flagValue string) { … } // parseLogFlag checks the flag passed to -json // for version,destination format and returns the two parts. func parseLogFlag(flag, value string) (version int, directory string) { … } // isWindowsDriveURIPath returns true if the file URI is of the format used by // Windows URIs. The url.Parse package does not specially handle Windows paths // (see golang/go#6027), so we check if the URI path has a drive prefix (e.g. "/C:"). // (copied from tools/internal/span/uri.go) // this is less comprehensive that the processing in filepath.IsAbs on Windows. func isWindowsDriveURIPath(uri string) bool { … } func parseLogPath(destination string) (string, string) { … } // checkLogPath does superficial early checking of the string specifying // the directory to which optimizer logging is directed, and if // it passes the test, stores the string in LO_dir. func checkLogPath(destination string) string { … } var loggedOpts … var mu … // NewLoggedOpt allocates a new LoggedOpt, to later be passed to either NewLoggedOpt or LogOpt as "args". // Pos is the source position (including inlining), what is the message, pass is which pass created the message, // funcName is the name of the function // A typical use for this to accumulate an explanation for a missed optimization, for example, why did something escape? func NewLoggedOpt(pos, lastPos src.XPos, what, pass, funcName string, args ...interface{ … } // LogOpt logs information about a (usually missed) optimization performed by the compiler. // Pos is the source position (including inlining), what is the message, pass is which pass created the message, // funcName is the name of the function. func LogOpt(pos src.XPos, what, pass, funcName string, args ...interface{ … } // LogOptRange is the same as LogOpt, but includes the ability to express a range of positions, // not just a point. func LogOptRange(pos, lastPos src.XPos, what, pass, funcName string, args ...interface{ … } // Enabled returns whether optimization logging is enabled. func Enabled() bool { … } type byPos … func (x byPos) Len() int { … } func (x byPos) Less(i, j int) bool { … } func (x byPos) Swap(i, j int) { … } func writerForLSP(subdirpath, file string) io.WriteCloser { … } func fixSlash(f string) string { … } func uriIfy(f string) DocumentURI { … } // Return filename, replacing a first occurrence of $GOROOT with the // actual value of the GOROOT (because LSP does not speak "$GOROOT"). func uprootedPath(filename string) string { … } // FlushLoggedOpts flushes all the accumulated optimization log entries. func FlushLoggedOpts(ctxt *obj.Link, slashPkgPath string) { … } // newRange returns a single-position Range for the compiler source location p. func newRange(p, last src.Pos) Range { … } // newLocation returns the Location for the compiler source location p. func newLocation(p, last src.Pos) Location { … } // appendInlinedPos extracts inlining information from posTmp and append it to diagnostic. func appendInlinedPos(posTmp, lastTmp []src.Pos, diagnostic *Diagnostic) { … } // parsePos expands a src.XPos into a slice of src.Pos, with the outermost first. // It returns the slice, and the outermost. func parsePos(ctxt *obj.Link, pos src.XPos, posTmp []src.Pos) ([]src.Pos, src.Pos) { … }