package utils
import "github.com/docker/compose/v2/pkg/utils"
Index ¶
- Constants
- func Contains[T any](origin []T, element T) bool
- func DisplayScanSuggestMsg()
- func DurationSecondToInt(d *time.Duration) *int
- func GetWriter(consumer func(string)) io.WriteCloser
- func StringContains(array []string, needle string) bool
- func StringToBool(s string) bool
- type SafeBuffer
Constants ¶
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
Functions ¶
func Contains ¶
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 ¶
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 ¶
StringContains check if an array contains a specific value
func StringToBool ¶
StringToBool converts a string to a boolean ignoring errors
Types ¶
type SafeBuffer ¶
type SafeBuffer struct {
// contains filtered or unexported fields
}
SafeBuffer is a thread safe version of bytes.Buffer
func (*SafeBuffer) Bytes ¶
func (b *SafeBuffer) Bytes() []byte
Bytes is a thread safe version of bytes.Buffer::Bytes
func (*SafeBuffer) Read ¶
func (b *SafeBuffer) Read(p []byte) (n int, err error)
Read is a thread safe version of bytes.Buffer::Read
func (*SafeBuffer) RequireEventuallyContains ¶
func (b *SafeBuffer) RequireEventuallyContains(t testing.TB, v string)
RequireEventuallyContains is a thread safe eventual checker for the buffer content
func (*SafeBuffer) String ¶
func (b *SafeBuffer) String() string
String is a thread safe version of bytes.Buffer::String
func (*SafeBuffer) Write ¶
func (b *SafeBuffer) Write(p []byte) (n int, err error)
Write is a thread safe version of bytes.Buffer::Write
Source Files ¶
durationutils.go safebuffer.go scan_suggest.go slices.go stringutils.go writer.go
- Version
- v2.12.0
- Published
- Oct 18, 2022
- Platform
- js/wasm
- Imports
- 16 packages
- Last checked
- 2 hours ago –
Tools for package owners.