From 7f006b63c8d7e28e55a6d471881e9c118df80585 Mon Sep 17 00:00:00 2001 From: cui fliter Date: Thu, 10 Oct 2024 23:04:57 +0800 Subject: [PATCH] fix: fix `getExcludedColumns` slice allocation (#1788) `getExcludedColumns` allocates a slice of a particular length instead of capacity, which does not achieve the intended effect -- memory optimization. --- internal/storage/dial.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/storage/dial.go b/internal/storage/dial.go index 16cd75c989..3ee99395be 100644 --- a/internal/storage/dial.go +++ b/internal/storage/dial.go @@ -180,7 +180,7 @@ func getExcludedColumns(model interface{}, includeColumns ...string) ([]string, cols.Remove(f) } - xcols := make([]string, len(cols.Cols)) + xcols := make([]string, 0, len(cols.Cols)) for n := range cols.Cols { // gobuffalo updates the updated_at column automatically if n == "updated_at" {