fakecontext

package
v25.0.16+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2026 License: Apache-2.0 Imports: 6 Imported by: 127 modules, 374 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithBinaryFiles

func WithBinaryFiles(files map[string]*bytes.Buffer) func(*Fake) error

WithBinaryFiles adds the specified files in the build context, content is binary

func WithDockerfile

func WithDockerfile(content string) func(*Fake) error

WithDockerfile adds the specified content as Dockerfile in the build context

func WithFile

func WithFile(name, content string) func(*Fake) error

WithFile adds the specified file (with content) in the build context

func WithFiles

func WithFiles(files map[string]string) func(*Fake) error

WithFiles adds the specified files in the build context, content is a string

Types

type Fake

type Fake struct {
	Dir string
}

Fake creates directories that can be used as a build context

func New

func New(t testing.TB, dir string, modifiers ...func(*Fake) error) *Fake

New creates a fake build context

func (*Fake) Add

func (f *Fake) Add(file, content string) error

Add a file at a path, creating directories where necessary

func (*Fake) AsTarReader

func (f *Fake) AsTarReader(t testing.TB) io.ReadCloser

AsTarReader returns a ReadCloser with the contents of Dir as a tar archive.

func (*Fake) Close

func (f *Fake) Close() error

Close deletes the context

func (*Fake) Delete

func (f *Fake) Delete(file string) error

Delete a file at a path

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL