github.com/abergmeier/buildkit_ex@v0.0.0-20220613202848-1145f3866588/internal/collect.go (about) 1 package internal 2 3 import "github.com/moby/buildkit/frontend/dockerfile/instructions" 4 5 func collectSourcePaths(stages []instructions.Stage, sourcePaths chan<- string) { 6 for _, s := range stages { 7 collectSourcePathsOfStage(s, sourcePaths) 8 } 9 } 10 11 func collectSourcePathsOfStage(s instructions.Stage, sourcePaths chan<- string) { 12 13 for _, c := range s.Commands { 14 switch t := c.(type) { 15 case *instructions.AddCommand: 16 case *instructions.CopyCommand: 17 for _, sp := range t.SourcePaths { 18 sourcePaths <- sp 19 } 20 } 21 } 22 }