utils

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func Deduplicate

func Deduplicate(s string) string

func GetFileSize

func GetFileSize(file *os.File) uint64

func GetImageBase

func GetImageBase(file *pe.File) uint64

func GetUrlFromListen

func GetUrlFromListen(listen string) string

func InitLogger

func InitLogger(level slog.Level)

func NewPb

func NewPb(max int64, desc string, disable bool) *progressbar.ProgressBar

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 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 WaitSignal

func WaitSignal()

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

Types

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