// useSumDB reports whether to use the Go checksum database for the given module. func useSumDB(mod module.Version) bool { … } // lookupSumDB returns the Go checksum database's go.sum lines for the given module, // along with the name of the database. func lookupSumDB(mod module.Version) (dbname string, lines []string, err error) { … } var dbOnce … var dbName … var db … var dbErr … func dbDial() (dbName string, db *sumdb.Client, err error) { … } type dbClient … func (c *dbClient) ReadRemote(path string) ([]byte, error) { … } // initBase determines the base URL for connecting to the database. // Determining the URL requires sending network traffic to proxies, // so this work is delayed until we need to download something from // the database. If everything we need is in the local cache and // c.ReadRemote is never called, we will never do this work. func (c *dbClient) initBase() { … } // ReadConfig reads the key from c.key // and otherwise reads the config (a latest tree head) from GOPATH/pkg/sumdb/<file>. func (c *dbClient) ReadConfig(file string) (data []byte, err error) { … } // WriteConfig rewrites the latest tree head. func (*dbClient) WriteConfig(file string, old, new []byte) error { … } // ReadCache reads cached lookups or tiles from // GOPATH/pkg/mod/cache/download/sumdb, // which will be deleted by "go clean -modcache". func (*dbClient) ReadCache(file string) ([]byte, error) { … } // WriteCache updates cached lookups or tiles. func (*dbClient) WriteCache(file string, data []byte) { … } func (*dbClient) Log(msg string) { … } func (*dbClient) SecurityError(msg string) { … }