utils

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNewFileUnderCurrentDirectory added in v1.2.1

func CreateNewFileUnderCurrentDirectory(path string, flag int) (io.Writer, error)

CreateNewFileUnderCurrentDirectory create a new file under the current directory and fails if the file already exists. The file is always created with the pemisisons `0o600`.

func IsPresubmitTests

func IsPresubmitTests() bool

IsPresubmitTests returns true if running in pre-submit tests.

func MarshalToBytes added in v1.2.1

func MarshalToBytes(args interface{}) ([]byte, error)

MarshalToBytes marshals to a byte array.

func MarshalToString added in v1.2.1

func MarshalToString(args interface{}) (string, error)

MarshalToString marshals to a string.

func PathIsUnderCurrentDirectory added in v1.2.1

func PathIsUnderCurrentDirectory(path string) error

PathIsUnderCurrentDirectory checks whether the `path` is under the current working directory. Examples: ./file, ./some/path, ../<cwd>.file would return `nil`. `../etc/password` would return an error.

func UnmarshalList added in v1.2.1

func UnmarshalList(arg string) ([]string, error)

UnmarshalList unmarshals a string into a list of strings.

func VerifyAttestationPath added in v1.2.1

func VerifyAttestationPath(path string) error

VerifyAttestationPath verifies that the path of an attestation is valid. It checks that the path is under the current working directory and that the extension of the file is `intoto.jsonl`.

Types

type ErrInternal added in v1.2.1

type ErrInternal struct {
	errors.WrappableError
}

ErrInternal indicates an internal error.

type ErrInvalidPath added in v1.2.1

type ErrInvalidPath struct {
	errors.WrappableError
}

ErrInvalidPath indicates an invalid path.

Jump to

Keyboard shortcuts

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