util

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: Apache-2.0 Imports: 13 Imported by: 28

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandHomeDir added in v1.21.1

func ExpandHomeDir(path string) (string, error)

ExpandHomeDir expands filepath with a tilde prefix. If the given filepath doesn't have a tilde this function return the filepath as it is.

func NewTestBufferHandlerFunc added in v1.21.1

func NewTestBufferHandlerFunc(method string, requestBuffer io.Writer, responseHeader int, responseBody string) http.Handler

NewTestBufferHandlerFunc returns an http.Handler which buffers the request body, writes the response header, and writes the response body. Requests that do not match the specified method recieve 404 Not Found.

func ParseJsonFromFile added in v1.21.1

func ParseJsonFromFile(filePath string, tolerateEmptyInput bool) (map[string]interface{}, error)

func ParseJsonFromFileOrStdin added in v0.4.0

func ParseJsonFromFileOrStdin(filePath string, tolerateEmptyStdin bool) (map[string]interface{}, error)

func ReadArgsOrStdin added in v1.21.1

func ReadArgsOrStdin(args []string) (string, error)

func TestGateMuxWithVersionHandler added in v1.21.1

func TestGateMuxWithVersionHandler() *http.ServeMux

func TestPrettyJsonDiff added in v1.21.1

func TestPrettyJsonDiff(t *testing.T, description, expected string, recieved []byte)

TestPrettyJsonDiff compares prettified json against an expected json string. Leading and trailing whitespace is trimmed before the comparison.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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