Fix id flip
This commit is contained in:
@@ -311,7 +311,7 @@ func buildNativeUnchecked(p *project.Project, opts NativeBuildOptions, progress
|
||||
if err != nil {
|
||||
return BuildResult{}, err
|
||||
}
|
||||
lockAdded, lockPruned, err := saveNativeBaseLockfiles(collected)
|
||||
lockAdded, lockPruned, err := saveNativeLockfiles(collected)
|
||||
if err != nil {
|
||||
return BuildResult{}, err
|
||||
}
|
||||
@@ -419,11 +419,11 @@ func nativeCompileGroup(datasetName string) string {
|
||||
}
|
||||
}
|
||||
|
||||
func saveNativeBaseLockfiles(collected []nativeCollectedDataset) (int, int, error) {
|
||||
func saveNativeLockfiles(collected []nativeCollectedDataset) (int, int, error) {
|
||||
added := 0
|
||||
pruned := 0
|
||||
for _, dataset := range collected {
|
||||
if dataset.Dataset.Kind != nativeDatasetBase || dataset.Dataset.LockPath == "" {
|
||||
if dataset.Dataset.LockPath == "" {
|
||||
continue
|
||||
}
|
||||
current, err := loadLockfile(dataset.Dataset.LockPath)
|
||||
@@ -2769,7 +2769,6 @@ func collectPlainDataset(dataset nativeDataset) (nativeCollectedDataset, error)
|
||||
}
|
||||
|
||||
rows := make([]map[string]any, 0, len(rawRows))
|
||||
lockModified := false
|
||||
explicitID := make([]bool, 0, len(rawRows))
|
||||
for index, raw := range rawRows {
|
||||
rowObj, ok := raw.(map[string]any)
|
||||
@@ -2804,7 +2803,6 @@ func collectPlainDataset(dataset nativeDataset) (nativeCollectedDataset, error)
|
||||
usedIDs[nextID] = struct{}{}
|
||||
nextID = nextAvailableID(usedIDs)
|
||||
}
|
||||
lockModified = true
|
||||
continue
|
||||
}
|
||||
if !explicitID[index] {
|
||||
@@ -2812,12 +2810,6 @@ func collectPlainDataset(dataset nativeDataset) (nativeCollectedDataset, error)
|
||||
}
|
||||
}
|
||||
|
||||
if lockModified {
|
||||
if err := saveLockfile(dataset.LockPath, lockData); err != nil {
|
||||
return nativeCollectedDataset{}, fmt.Errorf("dataset %s: %w", dataset.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
slices.SortFunc(rows, func(a, b map[string]any) int {
|
||||
return a["id"].(int) - b["id"].(int)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user