util

package
v0.2.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ASCIIEqualFold

func ASCIIEqualFold(s, t string) bool

func CopySlogValuesToNewCtx

func CopySlogValuesToNewCtx(sourceCtx, destCtx context.Context) context.Context

func DetectFileType

func DetectFileType(data []byte) string

DetectFileType detects the MIME type from file content

func GetCloudConfigSpecFromExtraSpecs

func GetCloudConfigSpecFromExtraSpecs(extraSpecs json.RawMessage) (cloudconfig.CloudConfigSpec, error)

func GetSlogValuesFromContext

func GetSlogValuesFromContext(ctx context.Context) []slog.Attr

func GetTmpFileHandle

func GetTmpFileHandle(baseDir string) (*os.File, error)

func ParseGARMAgentAssetName

func ParseGARMAgentAssetName(name string) (osType, osArch string, err error)

ParseGARMAgentAssetName parses a garm-agent asset name to extract OS type and architecture

func ParseToolsFromRelease

func ParseToolsFromRelease(releaseData []byte) (map[string]params.GARMAgentTool, error)

ParseToolsFromRelease parses cached release data and extracts GARM agent tool information

func WithSlogContext

func WithSlogContext(ctx context.Context, attrs ...slog.Attr) context.Context

Types

type GitHubRelease

type GitHubRelease struct {
	TagName    string               `json:"tag_name"`
	Name       string               `json:"name"`
	TarballURL string               `json:"tarball_url"`
	Assets     []GitHubReleaseAsset `json:"assets"`
}

GitHubRelease represents a GitHub release

type GitHubReleaseAsset

type GitHubReleaseAsset struct {
	ID            uint      `json:"id"`
	Name          string    `json:"name"`
	Size          uint      `json:"size"`
	DownloadCount uint      `json:"download_count"`
	CreatedAt     time.Time `json:"created_at"`
	Digest        string    `json:"digest"`
	DownloadURL   string    `json:"browser_download_url"`
}

GitHubReleaseAsset represents an asset from a GitHub release

type GitHubReleases

type GitHubReleases []GitHubRelease

GitHubReleases represents an array of GitHub releases

type SlogMultiHandler

type SlogMultiHandler struct {
	Handlers []slog.Handler
}

func (*SlogMultiHandler) Enabled

func (m *SlogMultiHandler) Enabled(ctx context.Context, level slog.Level) bool

func (*SlogMultiHandler) Handle

func (m *SlogMultiHandler) Handle(ctx context.Context, r slog.Record) error

func (*SlogMultiHandler) WithAttrs

func (m *SlogMultiHandler) WithAttrs(attrs []slog.Attr) slog.Handler

func (*SlogMultiHandler) WithGroup

func (m *SlogMultiHandler) WithGroup(name string) slog.Handler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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