os_steps

package
v0.0.0-...-ace5988 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: BSD-3-Clause Imports: 8 Imported by: 19

Documentation

Index

Constants

View Source
const TempDirContextKey = tempDirContextKeyType("overwriteTempDir")

TempDirContextKey can be used to overwrite TempDir in tests.

Variables

This section is empty.

Functions

func Abs

func Abs(ctx context.Context, path string) (string, error)

Abs is a wrapper for filepath.Abs.

func Chdir

func Chdir(ctx context.Context, dir string) error

Chdir is a wrapper for os.Chdir.

func CopyFile

func CopyFile(ctx context.Context, src, dst string) error

CopyFile copies the given file.

func MkdirAll

func MkdirAll(ctx context.Context, path string) (err error)

MkdirAll is a wrapper for os.MkdirAll.

func ReadDir

func ReadDir(ctx context.Context, path string) ([]fs.DirEntry, error)

ReadDir is a wrapper for os.ReadDir.

func ReadFile

func ReadFile(ctx context.Context, path string) ([]byte, error)

ReadFile is a wrapper for os.ReadFile.

func RemoveAll

func RemoveAll(ctx context.Context, path string) (err error)

RemoveAll is a wrapper for os.RemoveAll.

func Rename

func Rename(ctx context.Context, oldpath, newpath string) error

Rename is a wrapper for os.Rename.

func Stat

func Stat(ctx context.Context, path string) (os.FileInfo, error)

Stat is a wrapper for os.Stat.

func TempDir

func TempDir(ctx context.Context, dir, pattern string) (string, error)

TempDir is a wrapper for os.MkdirTemp. In swarming, this file might not be in /tmp, but in a subdirectory of the swarming task work directory.

Use the TempDirContextKey to overwrite os.MkdirTemp with another function with the same signature.

func Which

func Which(ctx context.Context, exe string) (string, error)

Which returns the result of "which <exe>" (or "where <exe>" on Windows).

func WriteFile

func WriteFile(ctx context.Context, path string, data []byte, perm os.FileMode) error

WriteFile is a wrapper for os.WriteFile.

Types

This section is empty.

Jump to

Keyboard shortcuts

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