code: func (f *ResolvedFile) Serialize(w io.Writer) error {
  	// piggyback on top of File.Serialize.
  	packagesBySubdir := make(map[string]PackageSlice, len(f.PackagesBySubdir))
  	for k, v := range f.PackagesBySubdir {
  		slc := make(PackageSlice, len(v))
  		for i, pkg := range v {
  			slc[i] = PackageDef{
  				PackageTemplate:   pkg.PackageName,
  				UnresolvedVersion: pkg.InstanceID,
  			}
  		}
  		packagesBySubdir[k] = slc
  	}
  	return (&File{
  		ServiceURL:       f.ServiceURL,
  		ParanoidMode:     f.ParanoidMode,
  		PackagesBySubdir: packagesBySubdir,
  	}).Serialize(w)
  }
docs: // Serialize writes the ResolvedFile to an io.Writer in canonical order.