From c51be644080404d34cb5cddd76853a7a1adafc2a Mon Sep 17 00:00:00 2001 From: ashpect Date: Wed, 14 Aug 2024 15:23:43 +0530 Subject: [PATCH] i think it might work now --- pkg/staging/helper.go | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/pkg/staging/helper.go b/pkg/staging/helper.go index 76bc9fa..6331357 100644 --- a/pkg/staging/helper.go +++ b/pkg/staging/helper.go @@ -41,22 +41,22 @@ func copy(src llb.State, srcPath string, dest llb.State, destPath string) llb.St })) } -// func copyForStates(src llb.State, dst llb.State, srcpaths []string, dstpath string) llb.State { -// return dst.With( -// copyMultiple(src, srcpaths, dstpath), -// ) -// } - -// func copyMultiple(src llb.State, srcPaths []string, destPath string) llb.StateOption { -// var stateOptions []llb.StateOption -// for _, srcPath := range srcPaths { -// stateOptions = append(stateOptions, copyFrom(src, srcPath, destPath)) -// } - -// return func(s llb.State) llb.State { -// for _, stateOption := range stateOptions { -// s = stateOption(s) -// } -// return s -// } -// } +func copyForStates(src llb.State, dst llb.State, srcpaths []string, dstpath string) llb.State { + return dst.With( + copyMultiple(src, srcpaths, dstpath), + ) +} + +func copyMultiple(src llb.State, srcPaths []string, destPath string) llb.StateOption { + var stateOptions []llb.StateOption + for _, srcPath := range srcPaths { + stateOptions = append(stateOptions, copyFrom(src, srcPath, destPath)) + } + + return func(s llb.State) llb.State { + for _, stateOption := range stateOptions { + s = stateOption(s) + } + return s + } +}