Back to godoc.org

Package utils

v0.0.0-...-1557bcf
Latest Go to latest

The latest major version is .

Published: Aug 13, 2020 | License: Apache-2.0 | Module: github.com/luci/luci-go

Overview

Package utils contains a bunch of small functions used by task/ subpackages.

Index

func IsTransientAPIError

func IsTransientAPIError(err error) bool

IsTransientAPIError returns true if error from Google API client indicates an error that can go away on its own in the future.

func ValidateKVList

func ValidateKVList(kind string, list []string, sep rune) error

ValidateKVList makes sure each string in the list is valid key-value pair.

func WrapAPIError

func WrapAPIError(err error) error

WrapAPIError wraps error from Google API client in transient wrapper if necessary.

type KV

type KV struct {
	Key   string
	Value string
}

KV is key and value strings.

type KVList

type KVList []KV

KVList if list of KV pairs.

func KVListFromMap

func KVListFromMap(m map[string]string) KVList

KVListFromMap converts a map to KVList.

func UnpackKVList

func UnpackKVList(list []string, sep rune) (out KVList)

UnpackKVList takes validated list of k-v pair strings and returns list of structs.

Silently skips malformed strings. Use ValidateKVList to detect them before calling this function.

func (KVList) Pack

func (l KVList) Pack(sep rune) []string

Pack converts KV list to a list of strings.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier