var doctype … var jsonStart … var jsonEnd … type Metadata … func (m *Metadata) FilePath() string { … } // extractMetadata extracts the Metadata from a byte slice. // It returns the Metadata value and the remaining data. // If no metadata is present the original byte slice is returned. func extractMetadata(b []byte) (meta Metadata, tail []byte, err error) { … } // updateMetadata scans $GOROOT/doc for HTML and Markdown files, reads their metadata, // and updates the DocMetadata map. func (c *Corpus) updateMetadata() { … } // MetadataFor returns the *Metadata for a given relative path or nil if none // exists. func (c *Corpus) MetadataFor(relpath string) *Metadata { … } // refreshMetadata sends a signal to update DocMetadata. If a refresh is in // progress the metadata will be refreshed again afterward. func (c *Corpus) refreshMetadata() { … } // refreshMetadataLoop runs forever, updating DocMetadata when the underlying // file system changes. It should be launched in a goroutine. func (c *Corpus) refreshMetadataLoop() { … }