sanitize

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForDockerLabel

func ForDockerLabel(s string) string

ForDockerLabel sanitizes a string for use as a Docker label Docker labels must contain only alphanumeric characters, periods, hyphens, and underscores

func ForDomainPart

func ForDomainPart(s string) string

ForDomainPart sanitizes a string for use as part of a domain name Domain parts can contain lowercase letters, numbers, and hyphens

func ForEnvironmentKey

func ForEnvironmentKey(s string) string

ForEnvironmentKey sanitizes a string for use as an environment variable key Environment keys must contain only uppercase letters, numbers, and underscores

func ForFilename

func ForFilename(s string) string

ForFilename sanitizes a string for use in a filename (kebab-case).

func ForProjectName

func ForProjectName(s string) string

ForProjectName sanitizes a string for use as a Docker Compose project name Project names must start with a letter and contain only lowercase letters, numbers, and underscores

func ForServiceName

func ForServiceName(s string) string

ForServiceName sanitizes a string for use as a service name Service names can contain letters, numbers, underscores, and hyphens

func SanitizeForTmuxSession

func SanitizeForTmuxSession(title string) string

SanitizeForTmuxSession creates a valid tmux session name from a string. It replaces spaces and special characters with hyphens, converts to lowercase, and ensures the name is a reasonable length.

func UTF8

func UTF8(data []byte) string

UTF8 takes a byte slice and returns a string with invalid UTF-8 sequences replaced. Invalid sequences are replaced with the Unicode replacement character (�). This is useful when reading files that may contain mixed encodings or corrupted data.

Types

This section is empty.

Jump to

Keyboard shortcuts

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