github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/pkg/tarsum/builder_context.go (about)

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