utils

package
v0.0.0-...-06b94e1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupWorkDir

func CleanupWorkDir(fs afero.Fs, path string)

CleanupWorkDir removes all files in a directory Eat any errors so we can call it from defer

func CreateWorkDir

func CreateWorkDir(fs afero.Fs) (string, error)

CreateWorkDir creates the working directory in tmp and some subdirectories

func FS

func FS(ctx context.Context) afero.Fs

func IsFile

func IsFile(ctx context.Context, path string) (bool, error)

func IsJson

func IsJson(data string) bool

detect if the string is json

func IsYamlMap

func IsYamlMap(data string) bool

detect if the string is yamlMap

func ToJSON

func ToJSON(data []byte) ([]byte, error)

ToJSON converts a single YAML document into a JSON document or returns an error. If the document appears to be JSON the YAML decoding path is not used.

func WithFS

func WithFS(ctx context.Context, fs afero.Fs) context.Context

func WriteTempFile

func WriteTempFile(ctx context.Context, data, prefix string) (string, error)

create a file in a temp dir with contents of data

Types

This section is empty.

Jump to

Keyboard shortcuts

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