util

package
v0.0.0-...-4c964c4 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultContext context.Context
)

Functions

func CheckGitVersionAtLeast

func CheckGitVersionAtLeast(atLeast string) error

CheckGitVersionAtLeast check git version is at least the constraint version

func EnsureExecutable

func EnsureExecutable(filename string) error

func GetHookTemplates

func GetHookTemplates() (hookNames, hookTpls, giteaHookTpls []string)

func Remove

func Remove(name string) error

Remove removes the named file or (empty) directory with at most 5 attempts.

func SanitizeCredentialURLs

func SanitizeCredentialURLs(s string) string

SanitizeCredentialURLs remove all credentials in URLs (starting with "scheme://") for the input string: "https://user:pass@domain.com" => "https://sanitized-credential@domain.com"

func SanitizeErrorCredentialURLs

func SanitizeErrorCredentialURLs(err error) error

SanitizeErrorCredentialURLs wraps the error and make sure the returned error message doesn't contain sensitive credentials in URLs

func SupportProcReceive

func SupportProcReceive() bool

SupportProcReceive returns true if the installed git binary supports proc-receive

func UnsafeBytesToString

func UnsafeBytesToString(b []byte) string

UnsafeBytesToString uses Go's unsafe package to convert a byte slice to a string.

func UnsafeStringToBytes

func UnsafeStringToBytes(s string) []byte

UnsafeStringToBytes uses Go's unsafe package to convert a string to a byte slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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