File: builder_context.go

package info (click to toggle)
docker.io 20.10.24%2Bdfsg1-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 60,824 kB
  • sloc: sh: 5,621; makefile: 593; ansic: 179; python: 162; asm: 7
file content (21 lines) | stat: -rw-r--r-- 693 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package tarsum // import "github.com/docker/docker/pkg/tarsum"

// BuilderContext is an interface extending TarSum by adding the Remove method.
// In general there was concern about adding this method to TarSum itself
// so instead it is being added just to "BuilderContext" which will then
// only be used during the .dockerignore file processing
// - see builder/evaluator.go
type BuilderContext interface {
	TarSum
	Remove(string)
}

func (bc *tarSum) Remove(filename string) {
	for i, fis := range bc.sums {
		if fis.Name() == filename {
			bc.sums = append(bc.sums[:i], bc.sums[i+1:]...)
			// Note, we don't just return because there could be
			// more than one with this name
		}
	}
}