utils

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Stdout = &SyncOutput{
	Mutex:  sync.Mutex{},
	output: os.Stderr,
}

Functions

func ApplyMemoryLimit added in v1.0.8

func ApplyMemoryLimit()

func Deduplicate

func Deduplicate(s string) string

func FatalError added in v0.3.1

func FatalError(err error)

func GetImageBase

func GetImageBase(file *pe.File) uint64

func GetURLFromListen added in v1.0.4

func GetURLFromListen(listen string) string

func InitLogger

func InitLogger(level slog.Level)

func Must added in v1.2.0

func Must(err error)

func PrefixToPath

func PrefixToPath(s string) (string, error)

PrefixToPath is the inverse of PathToPrefix, replacing escape sequences with the original character. from src/cmd/internal/objabi/path.go

func SortedKeys added in v1.0.0

func SortedKeys[T cmp.Ordered, U any](m map[T]U) []T

func UglyGuess

func UglyGuess(s string) string

UglyGuess an ugly hack for a known issue about golang compiler sees https://github.com/golang/go/issues/66313

func UsePanicForExit added in v1.0.5

func UsePanicForExit()

func WaitSignal

func WaitSignal()

WaitSignal waits for a Ctrl+C signal to exit the program.

Types

type Set added in v1.0.11

type Set[T comparable] map[T]struct{}

func NewSet added in v1.0.11

func NewSet[T comparable]() Set[T]

func (Set[T]) Add added in v1.0.11

func (s Set[T]) Add(item T)

func (Set[T]) Contains added in v1.0.11

func (s Set[T]) Contains(item T) bool

func (Set[T]) Remove added in v1.0.11

func (s Set[T]) Remove(item T)

func (Set[T]) ToSlice added in v1.0.11

func (s Set[T]) ToSlice() []T

type SyncOutput

type SyncOutput struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*SyncOutput) SetOutput

func (s *SyncOutput) SetOutput(output io.Writer)

func (*SyncOutput) Write

func (s *SyncOutput) Write(p []byte) (n int, err error)

type ValueOnce

type ValueOnce[T any] struct {
	*sync.Once
	// contains filtered or unexported fields
}

func NewOnce

func NewOnce[T any]() *ValueOnce[T]

func (*ValueOnce[T]) Get

func (o *ValueOnce[T]) Get() T

func (*ValueOnce[T]) Set

func (o *ValueOnce[T]) Set(v T)

Jump to

Keyboard shortcuts

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