code: func (v VersionsFile) Serialize(w io.Writer) error {
  	keys := make([]unresolvedVer, 0, len(v))
  	for k := range v {
  		keys = append(keys, k)
  	}
  	sort.Slice(keys, func(i, j int) bool {
  		l, r := keys[i], keys[j]
  		if l.pkg != r.pkg {
  			return l.pkg < r.pkg
  		}
  		return l.ver < r.ver
  	})
  
  	_, err := iotools.WriteTracker(w, func(w io.Writer) error {
  		fmt.Fprintf(w, "# This file is auto-generated by 'cipd ensure-file-resolve'.\n")
  		fmt.Fprintf(w, "# Do not modify manually. All changes will be overwritten.\n")
  		for _, key := range keys {
  			fmt.Fprintf(w, "\n%s\n\t%s\n\t%s\n", key.pkg, key.ver, v[key])
  		}
  		return nil
  	})
  	return err
  }
docs: // Serialize writes the VersionsFile to an io.Writer in canonical order.