file

package
v1.40.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 16 Imported by: 0 modules, 0 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

Overview

Package file is the file action: it looks at what is at a path, and reads it when it is a regular file, so that a step can check a log, a file written by what is tested, or that a file has come or gone. It writes, appends to or deletes a file as well, so that a workflow can make what it tests with and remove it, which it refuses under a read-only guard.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(with map[string]any) (map[string]any, error)

Run does what with asks for at a path, under no guard. See RunGuarded.

func RunGuarded

func RunGuarded(with map[string]any, guard sdk.Guard) (map[string]any, error)

RunGuarded does what op of with asks for at the path with gives, and returns the step's result: what is at the path afterwards, as read gives it. read, the default, only looks; write, append and delete change what is at the path, and are refused under a read-only guard before they do.

Nothing at the path is a result for the step's test to check, with res.exists false and status 1, so that a step can wait with retry for a file to come or to go. What is there is read only when it is a regular file; a path that cannot be looked at or read is an error.

func Spec

func Spec() actionspec.Spec

Spec declares the file action. It keeps to every kind of guard: it only reads under read-only, refusing write, append and delete, and connects to nothing. It cannot run without path.

Types

type Action

type Action struct {
	// contains filtered or unexported fields
}

func (*Action) Run

func (a *Action) Run(with map[string]any) (map[string]any, error)

func (*Action) RunStep

func (a *Action) RunStep(call sdk.Call) (map[string]any, map[string]any, error)

RunStep runs a step under the guard of the run, which refuses an op that writes under read-only. It keeps no state in the job.

type Req

type Req struct {
	Path      string `map:"path"`
	Op        string `map:"op"`
	Content   string `map:"content"`
	Mode      string `map:"mode"`
	Recursive bool   `map:"recursive"`
}

Jump to

Keyboard shortcuts

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