util

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2020 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFileEmpty = errors.New("file is empty")
View Source
var ErrFileNotText = errors.New("file is not a text file")

Functions

func GetEnvBoolDefault

func GetEnvBoolDefault(envVar string, defaultValue bool) bool

GetEnvBoolDefault is similar to GetEnvDefault, but with booleans instead of strings

func GetEnvDefault

func GetEnvDefault(envVar, defaultValue string) string

GetEnvDefault returns the value of the environment variable, or a default value if the environment variable is not defined or is an empty string

func InSlice added in v0.1.7

func InSlice(s string, slice []string) bool

InSlice returns true if a string is found in the slice

func IsTextFile

func IsTextFile(file *os.File) error

IsTextFile returns an error if the file is not of content-type 'text/plain'

func IsTextFileFromFilename added in v0.1.1

func IsTextFileFromFilename(filename string) error

func MarkdownCodify

func MarkdownCodify(s string) string

MarkdownCodify returns a markdown code string https://www.markdownguide.org/basic-syntax/#code

Types

This section is empty.

Jump to

Keyboard shortcuts

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