utils

package
v2.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: Apache-2.0 Imports: 16 Imported by: 6 modules, 15 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ScanSuggestMsg = "Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them"

ScanSuggestMsg display a message after a successful build to suggest use of `docker scan` command

Variables

This section is empty.

Functions

func Contains added in v2.11.0

func Contains[T any](origin []T, element T) bool

Contains helps to detect if a non-comparable struct is part of an array only use this method if you can't rely on existing golang Contains function of slices (https://pkg.go.dev/golang.org/x/exp/slices#Contains)

func DisplayScanSuggestMsg

func DisplayScanSuggestMsg()

DisplayScanSuggestMsg displlay a message suggesting users can scan new image

func DurationSecondToInt added in v2.12.0

func DurationSecondToInt(d *time.Duration) *int

func GetWriter

func GetWriter(consumer func(string)) io.WriteCloser

GetWriter creates a io.Writer that will actually split by line and format by LogConsumer

func StringContains

func StringContains(array []string, needle string) bool

StringContains check if an array contains a specific value

func StringToBool added in v2.3.0

func StringToBool(s string) bool

StringToBool converts a string to a boolean ignoring errors

Types

type SafeBuffer added in v2.12.0

type SafeBuffer struct {
	// contains filtered or unexported fields
}

SafeBuffer is a thread safe version of bytes.Buffer

func (*SafeBuffer) Bytes added in v2.12.0

func (b *SafeBuffer) Bytes() []byte

Bytes is a thread safe version of bytes.Buffer::Bytes

func (*SafeBuffer) Read added in v2.12.0

func (b *SafeBuffer) Read(p []byte) (n int, err error)

Read is a thread safe version of bytes.Buffer::Read

func (*SafeBuffer) RequireEventuallyContains added in v2.12.0

func (b *SafeBuffer) RequireEventuallyContains(t testing.TB, v string)

RequireEventuallyContains is a thread safe eventual checker for the buffer content

func (*SafeBuffer) String added in v2.12.0

func (b *SafeBuffer) String() string

String is a thread safe version of bytes.Buffer::String

func (*SafeBuffer) Write added in v2.12.0

func (b *SafeBuffer) Write(p []byte) (n int, err error)

Write is a thread safe version of bytes.Buffer::Write

Jump to

Keyboard shortcuts

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