func (m *v1beta1Migrator) writeV1LockFile(
	configPath string,
	config buflock.ExternalConfigV1,
) (retErr error) {
	v1ConfigData, err := encoding.MarshalYAML(&config)
	if err != nil {
		return fmt.Errorf("failed to marshal new lock file: %w", err)
	}
	v1ConfigData = append([]byte(buflock.Header), v1ConfigData...)
	return os.WriteFile(configPath, v1ConfigData, 0600)
}
// writeV1LockFile atomically replaces the old lock file by first writing
// the new lock file to a temporary file and then moving it to the old lock file path.
// If we fail to marshal or write, the old lock file is not touched.
writeV1LockFile atomically replaces the old lock file by first writing
the new lock file to a temporary file and then moving it to the old lock file path.
If we fail to marshal or write, the old lock file is not touched.
// writeV1LockFile atomically replaces the old lock file by first writing // the new lock file to a temporary file and then moving it to the old lock file path . // If we fail to marshal or write the old lock file is not touched .
func (m *v1beta1Migrator) writeV1LockFile(
	configPath string,
	config buflock.ExternalConfigV1,
) (retErr error) {
	v1ConfigData, err := encoding.MarshalYAML(&config)
	if err != nil {
		return fmt.Errorf("failed to marshal new lock file: %w", err)
	}
	v1ConfigData = append([]byte(buflock.Header), v1ConfigData...)
	return os.WriteFile(configPath, v1ConfigData, 0600)
}
func ( m * v1beta1Migrator ) writeV1LockFile ( configPath string , config buflock . ExternalConfigV1 , ) ( retErr error ) { v1ConfigData , err := encoding . MarshalYAML ( & config ) if err != nil { return fmt . Errorf ( " " , err ) } v1ConfigData = append ( [ ] byte ( buflock . Header ) , v1ConfigData ... ) return os . WriteFile ( configPath , v1ConfigData , 0600 ) }
writeV1LockFile atomically replaces the old lock file by first writing
the new lock file to a temporary file and then moving it to the old lock file path.
writeV1LockFile atomically replaces the old lock file by first writing the new lock file to a temporary file and then moving it to the old lock file path .