builder_context.go 645 B

123456789101112131415161718192021
  1. package tarsum
  2. // BuilderContext is an interface extending TarSum by adding the Remove method.
  3. // In general there was concern about adding this method to TarSum itself
  4. // so instead it is being added just to "BuilderContext" which will then
  5. // only be used during the .dockerignore file processing
  6. // - see builder/evaluator.go
  7. type BuilderContext interface {
  8. TarSum
  9. Remove(string)
  10. }
  11. func (bc *tarSum) Remove(filename string) {
  12. for i, fis := range bc.sums {
  13. if fis.Name() == filename {
  14. bc.sums = append(bc.sums[:i], bc.sums[i+1:]...)
  15. // Note, we don't just return because there could be
  16. // more than one with this name
  17. }
  18. }
  19. }