// ModuleHashes computes and returns a mapping between shortened module names and their corresponding Go module checksum.
// Since the version of a module is used to compute the Go checksum (i.e. two modules with the same directory contents
// have a different checksum if their versions are different), the versions of the given VersionEnclosure will be used
// for this purpose.
ModuleHashes computes and returns a mapping between shortened module names and their corresponding Go module checksum.
Since the version of a module is used to compute the Go checksum , the versions of the given VersionEnclosure will be used
for this purpose.
// ModuleHashes computes and returns a mapping between shortened module names and their corresponding Go module checksum . // Since the version of a module is used to compute the Go checksum ( i . e . two modules with the same directory contents // have a different checksum if their versions are different ) the versions of the given VersionEnclosure will be used // for this purpose .
func (r *Repository) ModuleHashes(enc VersionEnclosure) (map[string]string, error) {
	modules, err := r.Modules()
	if err != nil {
		return nil, fmt.Errorf("couldn't compute module hashes: %v", err)
	}
	hashes := map[string]string{}
	for _, m := range modules {
		hash, err := r.golist.Checksum(m, enc.ModuleVersions[m].Version)
		if err != nil {
			return nil, fmt.Errorf("couldn't compute module hashes: %v", err)
		}
		hashes[m] = hash
	}
	return hashes, nil
}
func ( r * Repository ) ModuleHashes ( enc VersionEnclosure ) ( map [ string ] string , error ) { modules , err := r . Modules ( ) if err != nil { return nil , fmt . Errorf ( " " , err ) } hashes := map [ string ] string { } for _ , m := range modules { hash , err := r . golist . Checksum ( m , enc . ModuleVersions [ m ] . Version ) if err != nil { return nil , fmt . Errorf ( " " , err ) } hashes [ m ] = hash } return hashes , nil }
ModuleHashes computes and returns a mapping between shortened module names and their corresponding Go module checksum.
ModuleHashes computes and returns a mapping between shortened module names and their corresponding Go module checksum .