Documentation
¶
Index ¶
- Constants
- Variables
- func Abbrev(words []string) map[string]string
- func AppendNewline(s string) string
- func BenchmarkJobItem(label string, f func())
- func BenchmarkJobReport()
- func BenchmarkJobWidth() int
- func BenchmarkRealtime(f func()) float64
- func BenchmarkReportReport()
- func CurrentFile() string
- func CurrentMethodName() string
- func DateAsctime(t time.Time) string
- func DateCWDay(t time.Time) int
- func DateCWYear(t time.Time) int
- func DateCWeek(t time.Time) int
- func DateCivil(year, month, day int) time.Time
- func DateDownto(start, end time.Time, fn func(time.Time))
- func DateHttpdate(t time.Time) string
- func DateISO8601(str string) time.Time
- func DateISO8601Format(t time.Time) string
- func DateInspect(t time.Time) string
- func DateIsLeapYear(year int) bool
- func DateJD(jd int) time.Time
- func DateLeap(t time.Time) bool
- func DateNextDay(t time.Time, n int) time.Time
- func DateNextMonth(t time.Time, n int) time.Time
- func DateNextYear(t time.Time, n int) time.Time
- func DateParse(str string) time.Time
- func DatePrevDay(t time.Time, n int) time.Time
- func DatePrevMonth(t time.Time, n int) time.Time
- func DatePrevYear(t time.Time, n int) time.Time
- func DateRFC2822(t time.Time) string
- func DateRFC3339(t time.Time) string
- func DateShiftMonths(t time.Time, n int) time.Time
- func DateStep(start, end time.Time, step int, fn func(time.Time))
- func DateStrftime(t time.Time, format string) string
- func DateStrptime(str, format string) time.Time
- func DateToJD(t time.Time) int
- func DateToMJD(t time.Time) int
- func DateToS(t time.Time) string
- func DateToday() time.Time
- func DateUpto(start, end time.Time, fn func(time.Time))
- func DigestConstMissing(name string) string
- func DigestHexencode(data string) string
- func DigestMD5Base64digest(data string) string
- func DigestMD5Digest(data string) string
- func DigestMD5File(path string) string
- func DigestMD5Hexdigest(data string) string
- func DigestSHA1Base64digest(data string) string
- func DigestSHA1Digest(data string) string
- func DigestSHA1File(path string) string
- func DigestSHA1Hexdigest(data string) string
- func DigestSHA256Base64digest(data string) string
- func DigestSHA256Digest(data string) string
- func DigestSHA256File(path string) string
- func DigestSHA256Hexdigest(data string) string
- func DigestSHA384Base64digest(data string) string
- func DigestSHA384Digest(data string) string
- func DigestSHA384File(path string) string
- func DigestSHA384Hexdigest(data string) string
- func DigestSHA512Base64digest(data string) string
- func DigestSHA512Digest(data string) string
- func DigestSHA512File(path string) string
- func DigestSHA512Hexdigest(data string) string
- func DirChildren(path string) []string
- func DirEmpty(path string) bool
- func DirEntries(path string) []string
- func DirExist(path string) bool
- func DirGlob(pattern string) []string
- func DirHome() string
- func DirMktmpdir(prefix string) string
- func DirPwd() string
- func ERBVersion() string
- func EnvDelete(key string) string
- func EnvFetch(key, defaultVal string) string
- func EnvHasKey(key string) bool
- func EnvKeys() []string
- func EnvToMap() map[string]string
- func EnvValues() []string
- func EtcConfstr(name int) string
- func EtcEndgrent()
- func EtcEndpwent()
- func EtcGetlogin() string
- func EtcHome() string
- func EtcHomeForUser(name string) string
- func EtcNprocessors() int
- func EtcSetgrent()
- func EtcSetpwent()
- func EtcSysconf(name int) int
- func EtcSysconfdir() string
- func EtcSystmpdir() string
- func EtcTmpdir() string
- func EtcUname() map[string]string
- func FileUtilsChdir(path string)
- func FileUtilsChmod(mode int, path string)
- func FileUtilsChmodR(mode int, path string)
- func FileUtilsChown(user, group, path string)
- func FileUtilsChownR(user, group, path string)
- func FileUtilsCollectMethod(name string) string
- func FileUtilsCommands() []string
- func FileUtilsCompareFile(a, b string) bool
- func FileUtilsCopyEntry(src, dst string)
- func FileUtilsCopyStream(src, dst string)
- func FileUtilsCp(src, dst string)
- func FileUtilsCpLr(src, dst string)
- func FileUtilsCpR(src, dst string)
- func FileUtilsHaveOption(cmd, opt string) bool
- func FileUtilsInstall(src, dst string)
- func FileUtilsLn(src, dst string)
- func FileUtilsLnS(src, dst string)
- func FileUtilsLnSF(src, dst string)
- func FileUtilsLnSr(src, dst string)
- func FileUtilsMkdir(path string)
- func FileUtilsMkdirP(path string)
- func FileUtilsMv(src, dst string)
- func FileUtilsOptions() []string
- func FileUtilsOptionsOf(cmd string) []string
- func FileUtilsPwd() string
- func FileUtilsRemoveEntry(path string)
- func FileUtilsRm(path string)
- func FileUtilsRmF(path string)
- func FileUtilsRmRf(path string)
- func FileUtilsRmdir(path string)
- func FileUtilsTouch(path string)
- func FileUtilsUptodate(dst string, srcs []string) bool
- func FindCollect(dirs ...string) []string
- func FindPrune()
- func GetoptLongEach(g *GetoptLong, fn func(string, string))
- func GetoptLongErrorMessage(g *GetoptLong) string
- func GetoptLongGet(g *GetoptLong) (string, string)
- func GetoptLongHasError(g *GetoptLong) bool
- func GetoptLongIsQuiet(g *GetoptLong) bool
- func GetoptLongIsTerminated(g *GetoptLong) bool
- func GetoptLongOrdering(g *GetoptLong) int
- func GetoptLongSetError(g *GetoptLong, msg string)
- func GetoptLongSetOptions(g *GetoptLong, opts ...any)
- func GetoptLongSetOrdering(g *GetoptLong, order int)
- func GetoptLongSetQuiet(g *GetoptLong, q bool)
- func GetoptLongTerminate(g *GetoptLong)
- func Gets() string
- func IPAddrNtop(s string) string
- func JSONBracket(s string) map[string]string
- func JSONCreateFastState() string
- func JSONCreateID() string
- func JSONCreatePrettyState() string
- func JSONDeepConstGet(path string) string
- func JSONDumpDefaultOptions() map[string]string
- func JSONGenerate(v interface{}) string
- func JSONGenerator() string
- func JSONIconv(to, from, str string) string
- func JSONLoadDefaultOptions() map[string]string
- func JSONLoadFile(path string) map[string]string
- func JSONLoadFileStrict(path string) map[string]string
- func JSONParse(s string) map[string]string
- func JSONParser() string
- func JSONPrettyGenerate(v interface{}) string
- func JSONRecurseProc(obj, proc string)
- func JSONSetCreateID(id string)
- func JSONSetDumpDefaultOptions(opts map[string]string)
- func JSONSetGenerator(gen string)
- func JSONSetLoadDefaultOptions(opts map[string]string)
- func JSONSetParser(p string)
- func JSONSetState(s string)
- func JSONState() string
- func LoggerAdd(logger *slog.Logger, severity int, msg string)
- func LoggerFormatterCall(severity, datetime, progname, msg string) string
- func LoggerFormatterDatetimeFormat() string
- func LoggerFormatterSetDatetimeFormat(fmt string) string
- func LoggerLogDeviceClose()
- func LoggerLogDeviceDev() string
- func LoggerLogDeviceFilename() string
- func LoggerLogDeviceReopen()
- func LoggerLogDeviceWrite(msg string)
- func LoggerPeriodNextRotateTime() string
- func LoggerPeriodPreviousPeriodEnd() string
- func MutexAppendFeatures(m *MutexM)
- func MutexDefineAliases(m *MutexM)
- func MutexExtendObject(m *MutexM)
- func MutexExtended(m *MutexM)
- func MutexIsLocked(m *MutexM) bool
- func MutexLock(m *MutexM)
- func MutexSleep(m *MutexM, seconds float64)
- func MutexSynchronize(m *MutexM, fn func())
- func MutexTryLock(m *MutexM) bool
- func MutexUnlock(m *MutexM)
- func ObservableAddObserver(o *Observable, name string, fn func(...any))
- func ObservableCountObservers(o *Observable) int
- func ObservableDeleteObserver(o *Observable, name string)
- func ObservableDeleteObservers(o *Observable)
- func ObservableIsChanged(o *Observable) bool
- func ObservableNotifyObservers(o *Observable, args ...any)
- func ObservableSetChanged(o *Observable)
- func Open3Capture2(cmd string) []string
- func Open3Capture2e(cmd string) []string
- func Open3Capture3(cmd string) []string
- func Open3Pipeline(cmds ...string) []string
- func Open3PipelineR(cmds ...string) string
- func Open3PipelineRW(cmds ...string) string
- func Open3PipelineStart(cmds ...string) []string
- func Open3PipelineW(cmds ...string) []string
- func Open3Popen2(cmd string) []string
- func Open3Popen2e(cmd string) []string
- func Open3Popen3(cmd string) []string
- func OpenURIBaseURI(url string) string
- func OpenURICharset(url string) string
- func OpenURIContentEncoding(url string) []string
- func OpenURIContentType(url string) string
- func OpenURILastModified(url string) string
- func OpenURIMeta(url string) map[string]string
- func OpenURIOpen(url string) *bytes.Buffer
- func OpenURIRead(url string) *bytes.Buffer
- func OpenURIReadBody(url string) string
- func OpenURIStatus(url string) []string
- func PPGenspace(n int) string
- func PPNewline() string
- func PPSetSharingDetection(v bool)
- func PPSharingDetection() bool
- func PPWidthFor(out any) int
- func ProcessClockGettime() float64
- func ProcessGroups() []int
- func ProcessKill(signal interface{}, pid int) int
- func ProcessSpawn(args ...string) int
- func ProcessWait() int
- func RandomBytes(rng *rand.Rand, n int) string
- func RegexpCasefold(re *regexp.Regexp) bool
- func RegexpNamedCaptures(re *regexp.Regexp) map[string][]int
- func RegexpUnion(patterns ...string) *regexp.Regexp
- func SecureRandomAlphanumeric(n ...int) string
- func SecureRandomBase64(n ...int) string
- func SecureRandomBytes(n int) []byte
- func SecureRandomHex(n ...int) string
- func SecureRandomNumber(n ...int) int
- func SecureRandomURLSafeBase64(n ...int) string
- func SecureRandomUUID() string
- func ShellEscape(str string) string
- func ShellJoin(words []string) string
- func ShellSplit(line string) []string
- func SingletonClone(obj any) any
- func SingletonDump(obj any) string
- func SingletonDup(obj any) any
- func SingletonIncluded(obj any)
- func SingletonInit(obj any)
- func SingletonInstance(obj any) any
- func SingletonLoad(data string) any
- func StringIOGetbyte(buf *bytes.Buffer) int
- func StringIOGetc(buf *bytes.Buffer) string
- func StringIOGets(buf *bytes.Buffer) string
- func StringIOPutc(buf *bytes.Buffer, ch string) string
- func StringIOReadlines(buf *bytes.Buffer) []string
- func StringIOUngetbyte(buf *bytes.Buffer, b int)
- func StringIOUngetc(buf *bytes.Buffer, c string)
- func SyslogAlert(msg string)
- func SyslogClose()
- func SyslogConstantsIncluded()
- func SyslogCrit(msg string)
- func SyslogDebug(msg string)
- func SyslogEmerg(msg string)
- func SyslogErr(msg string)
- func SyslogFacility() int
- func SyslogIdent() string
- func SyslogInfo(msg string)
- func SyslogInspect() string
- func SyslogInstance() string
- func SyslogLog(level int, msg string)
- func SyslogLogMask(priority int) int
- func SyslogLogUpTo(priority int) int
- func SyslogMacrosIncluded()
- func SyslogMask() int
- func SyslogNotice(msg string)
- func SyslogOpen(ident string, rest ...int)
- func SyslogOpened() bool
- func SyslogOptions() int
- func SyslogSetMask(mask int) int
- func SyslogWarning(msg string)
- func System(args ...string) bool
- func Timeout(seconds float64, fn func())
- func TimeoutErrorMessage(e *TimeoutError) string
- func TmsToA(t *BenchmarkTms) []float64
- func TmsToH(t *BenchmarkTms) map[string]float64
- func ToFloat(val interface{}) float64
- func ToInteger(val interface{}) int
- func TsortDo(eachNode func(func(string)), eachChild func(string, func(string))) []string
- func TsortFromHash(deps map[string][]string) []string
- func TsortSCCDo(eachNode func(func(string)), eachChild func(string, func(string))) [][]string
- func TsortSCCFromDo(node string, eachNode func(func(string)), eachChild func(string, func(string))) [][]string
- func TsortSCCFromHash(deps map[string][]string) [][]string
- func TsortSCCFromNode(node string, deps map[string][]string) [][]string
- func URIBuildQuery(parts [][]string) string
- func URIDecodeComponent(s string) string
- func URIDecodeWwwForm(s string) [][]string
- func URIEncodeComponent(s string) string
- func URIEncodeWwwForm(m *stdlib.OrderedMap[string, string]) string
- func URIEncodeWwwFormFromPairs(pairs [][]string) string
- func URIEscape(s string) string
- func URIExtract(str string) []string
- func URIFor(scheme string) string
- func URIGetEncoding(charset string) string
- func URIOpen(s string) string
- func URIRegexp() string
- func URIRegisterScheme(scheme, klass string)
- func URISchemeList() map[string]string
- func URISplit(str string) []string
- func URIUnescape(s string) string
- func WeakRefAlive(w *WeakRef) bool
- func WeakRefGetObj(w *WeakRef) any
- func WeakRefSetObj(w *WeakRef, obj any)
- func YAMLAddBuiltinType(tag string)
- func YAMLAddDomainType(domain, tag string)
- func YAMLAddTag(tag, klass string)
- func YAMLConfig() string
- func YAMLDomainTypes() map[string]string
- func YAMLDump(v interface{}) string
- func YAMLDumpStream(objects ...interface{}) string
- func YAMLDumpTags() map[string]string
- func YAMLLibyamlVersion() string
- func YAMLLoad(s string) interface{}
- func YAMLLoadFile(filename string) interface{}
- func YAMLLoadStream(s string) interface{}
- func YAMLLoadTags() map[string]string
- func YAMLParse(s string) interface{}
- func YAMLParseFile(filename string) interface{}
- func YAMLParseStream(s string) interface{}
- func YAMLParser() string
- func YAMLRemoveType(tag string)
- func YAMLSafeDump(v interface{}) string
- func YAMLSafeLoadFile(filename string) interface{}
- func YAMLSetDomainTypes(types map[string]string)
- func YAMLSetDumpTags(tags map[string]string)
- func YAMLSetLoadTags(tags map[string]string)
- func YAMLToJSON(v interface{}) string
- func YAMLUnsafeLoad(s string) interface{}
- func YAMLUnsafeLoadFile(filename string) interface{}
- func ZlibAdler32(s string) int
- func ZlibAdler32Combine(a1 int, a2 int, len2 int) int
- func ZlibBestCompression() int
- func ZlibBestSpeed() int
- func ZlibCompress(s string) string
- func ZlibCrc32(s string) int
- func ZlibCrc32Combine(crc1 int, crc2 int, len2 int) int
- func ZlibCrcTable() string
- func ZlibDefaultCompression() int
- func ZlibDeflate(s string) string
- func ZlibDeflateLevel(s string, level int) string
- func ZlibGunzip(s string) string
- func ZlibGzip(s string) string
- func ZlibGzipLevel(s string, level int) string
- func ZlibInflate(s string) string
- func ZlibNoCompression() int
- func ZlibUncompress(s string) string
- func ZlibVersion() string
- type BenchmarkTms
- func BenchmarkBenchmark(f func()) []*BenchmarkTms
- func BenchmarkJobList() []*BenchmarkTms
- func BenchmarkMeasure(label string, f func()) *BenchmarkTms
- func BenchmarkReportItem(label string, f func()) *BenchmarkTms
- func BenchmarkReportList() []*BenchmarkTms
- func TmsAdd(a, b *BenchmarkTms) *BenchmarkTms
- func TmsDiv(a *BenchmarkTms, s float64) *BenchmarkTms
- func TmsMul(a *BenchmarkTms, s float64) *BenchmarkTms
- func TmsSub(a, b *BenchmarkTms) *BenchmarkTms
- func (t *BenchmarkTms) Inspect() string
- func (t *BenchmarkTms) TmsCStime() float64
- func (t *BenchmarkTms) TmsCUtime() float64
- func (t *BenchmarkTms) TmsLabel() string
- func (t *BenchmarkTms) TmsReal() float64
- func (t *BenchmarkTms) TmsStime() float64
- func (t *BenchmarkTms) TmsUtime() float64
- func (t *BenchmarkTms) ToS() string
- func (t *BenchmarkTms) Total() float64
- type DigestInstance
- func (d *DigestInstance) AppendBytes(data []byte) *DigestInstance
- func (d *DigestInstance) Base64digest() string
- func (d *DigestInstance) Base64digestBang() string
- func (d *DigestInstance) BlockSize() int
- func (d *DigestInstance) DigestBytes() string
- func (d *DigestInstance) DigestBytesBang() string
- func (d *DigestInstance) DigestSize() int
- func (d *DigestInstance) Equal(other *DigestInstance) bool
- func (d *DigestInstance) File(path string) *DigestInstance
- func (d *DigestInstance) Hexdigest() string
- func (d *DigestInstance) HexdigestBang() string
- func (d *DigestInstance) Inspect() string
- func (d *DigestInstance) New() *DigestInstance
- func (d *DigestInstance) Reset() *DigestInstance
- func (d *DigestInstance) ToS() string
- func (d *DigestInstance) Update(data string) *DigestInstance
- type ERB
- func (e *ERB) DefClass(_ string, _ string) string
- func (e *ERB) DefMethod(_ interface{}, _ string, _ string)
- func (e *ERB) DefModule(_ string) string
- func (e *ERB) MakeCompiler(_ string) string
- func (e *ERB) Result() string
- func (e *ERB) ResultWithHash(data map[string]any) string
- func (e *ERB) Run()
- func (e *ERB) SetEoutvar(_ string)
- func (e *ERB) SetFilename(name string)
- func (e *ERB) SetLineno(n int)
- type EtcGroupEntry
- type EtcPasswdEntry
- type GetoptLong
- type IPAddr
- func (a *IPAddr) And(b *IPAddr) *IPAddr
- func (a *IPAddr) Compare(b *IPAddr) int
- func (a *IPAddr) Eql(b *IPAddr) bool
- func (a *IPAddr) Family() int
- func (a *IPAddr) HashCode() int
- func (a *IPAddr) Hton() string
- func (a *IPAddr) Include(other *IPAddr) bool
- func (a *IPAddr) Inspect() string
- func (a *IPAddr) Ip6Arpa() string
- func (a *IPAddr) Ip6Int() string
- func (a *IPAddr) Ipv4Compat() *IPAddr
- func (a *IPAddr) Ipv4Mapped() *IPAddr
- func (a *IPAddr) IsIPv4() bool
- func (a *IPAddr) IsIPv4Compat() bool
- func (a *IPAddr) IsIPv4Mapped() bool
- func (a *IPAddr) IsIPv6() bool
- func (a *IPAddr) IsLinkLocal() bool
- func (a *IPAddr) IsLoopback() bool
- func (a *IPAddr) IsPrivate() bool
- func (a *IPAddr) Mask(prefixLen int) *IPAddr
- func (a *IPAddr) MaskBang(prefixLen int) *IPAddr
- func (a *IPAddr) Native() *IPAddr
- func (a *IPAddr) Netmask() string
- func (a *IPAddr) Not() *IPAddr
- func (a *IPAddr) Or(b *IPAddr) *IPAddr
- func (a *IPAddr) Prefix() int
- func (a *IPAddr) Reverse() string
- func (a *IPAddr) SetAddr(s string) *IPAddr
- func (a *IPAddr) SetPrefix(prefixLen int)
- func (a *IPAddr) SetZoneId(id string)
- func (a *IPAddr) ShiftLeft(n int) *IPAddr
- func (a *IPAddr) ShiftRight(n int) *IPAddr
- func (a *IPAddr) String() string
- func (a *IPAddr) Succ() *IPAddr
- func (a *IPAddr) ToI() *big.Int
- func (a *IPAddr) ToInt() *big.Int
- func (a *IPAddr) ToRange() []*IPAddr
- func (a *IPAddr) ToS() string
- func (a *IPAddr) ToString() string
- func (a *IPAddr) ZoneId() string
- type MutexM
- type Observable
- type OpenStruct
- func (o *OpenStruct) DeleteField(key string) interface{}
- func (o *OpenStruct) EachPair(fn func(string, interface{}))
- func (o *OpenStruct) Eql(other *OpenStruct) bool
- func (o *OpenStruct) Freeze() *OpenStruct
- func (o *OpenStruct) Get(key string) interface{}
- func (o *OpenStruct) GetString(key string) string
- func (o *OpenStruct) Hash() int
- func (o *OpenStruct) Inspect() string
- func (o *OpenStruct) IsFrozen() bool
- func (o *OpenStruct) MarshalDump() map[string]interface{}
- func (o *OpenStruct) MarshalLoad(data map[string]interface{})
- func (o *OpenStruct) RespondTo(method string) bool
- func (o *OpenStruct) Set(key string, value interface{})
- func (o *OpenStruct) ToH() map[string]interface{}
- func (o *OpenStruct) ToS() string
- type OpenURIResponse
- type OptionParser
- func (op *OptionParser) Accept(_ string)
- func (op *OptionParser) Getopts(args []string, specs []string) map[string]string
- func (op *OptionParser) Help() string
- func (op *OptionParser) On(flags []string, desc string, callback func(string))
- func (op *OptionParser) OnHead(flags []string, desc string, callback func(string))
- func (op *OptionParser) OnTail(flags []string, desc string, callback func(string))
- func (op *OptionParser) Order(args []string) []string
- func (op *OptionParser) OrderBang(args []string) []string
- func (op *OptionParser) Parse(args []string) []string
- func (op *OptionParser) ParseBang(args []string) []string
- func (op *OptionParser) Reject(_ string)
- func (op *OptionParser) Separator(text string)
- func (op *OptionParser) SetBanner(b string)
- func (op *OptionParser) SetProgramName(name string)
- func (op *OptionParser) SetVersion(v string)
- func (op *OptionParser) ToS() string
- type PStore
- func (ps *PStore) Abort()
- func (ps *PStore) Commit()
- func (ps *PStore) Delete(key string) string
- func (ps *PStore) Fetch(key string) string
- func (ps *PStore) Get(key string) string
- func (ps *PStore) GetUltraSafe() bool
- func (ps *PStore) Path() string
- func (ps *PStore) RootExists(key string) bool
- func (ps *PStore) Roots() []string
- func (ps *PStore) Set(key string, value string) string
- func (ps *PStore) SetUltraSafe(v bool)
- func (ps *PStore) Transaction(fn func())
- type Pathname
- func (p *Pathname) Ascend() []*Pathname
- func (p *Pathname) Atime() time.Time
- func (p *Pathname) Basename() string
- func (p *Pathname) Binread() string
- func (p *Pathname) Binwrite(data string)
- func (p *Pathname) Birthtime() time.Time
- func (p *Pathname) Children() []*Pathname
- func (p *Pathname) Chmod(mode int)
- func (p *Pathname) Chown(uid, gid int)
- func (p *Pathname) Cleanpath() *Pathname
- func (p *Pathname) Compare(other *Pathname) int
- func (p *Pathname) Concat(other string) *Pathname
- func (p *Pathname) Ctime() time.Time
- func (p *Pathname) Descend() []*Pathname
- func (p *Pathname) Dirname() string
- func (p *Pathname) EachChild() []*Pathname
- func (p *Pathname) EachEntry() []*Pathname
- func (p *Pathname) EachFilename() []string
- func (p *Pathname) EachLine() []string
- func (p *Pathname) Empty() bool
- func (p *Pathname) Entries() []*Pathname
- func (p *Pathname) Eql(other *Pathname) bool
- func (p *Pathname) Exist() bool
- func (p *Pathname) ExpandPath() string
- func (p *Pathname) Extname() string
- func (p *Pathname) Find() []*Pathname
- func (p *Pathname) Fnmatch(pattern string) bool
- func (p *Pathname) Freeze() *Pathname
- func (p *Pathname) Frozen() bool
- func (p *Pathname) Ftype() string
- func (p *Pathname) Glob(pattern string) []*Pathname
- func (p *Pathname) Hash() int
- func (p *Pathname) Inspect() string
- func (p *Pathname) IsAbsolute() bool
- func (p *Pathname) IsBlockdev() bool
- func (p *Pathname) IsChardev() bool
- func (p *Pathname) IsDirectory() bool
- func (p *Pathname) IsExecutable() bool
- func (p *Pathname) IsExecutableReal() bool
- func (p *Pathname) IsFile() bool
- func (p *Pathname) IsGrpowned() bool
- func (p *Pathname) IsMountpoint() bool
- func (p *Pathname) IsOwned() bool
- func (p *Pathname) IsPipe() bool
- func (p *Pathname) IsReadable() bool
- func (p *Pathname) IsReadableReal() bool
- func (p *Pathname) IsRelative() bool
- func (p *Pathname) IsRoot() bool
- func (p *Pathname) IsSetgid() bool
- func (p *Pathname) IsSetuid() bool
- func (p *Pathname) IsSocket() bool
- func (p *Pathname) IsSticky() bool
- func (p *Pathname) IsSymlink() bool
- func (p *Pathname) IsWorldReadable() bool
- func (p *Pathname) IsWorldWritable() bool
- func (p *Pathname) IsWritable() bool
- func (p *Pathname) IsWritableReal() bool
- func (p *Pathname) IsZero() bool
- func (p *Pathname) Join(other string) *Pathname
- func (p *Pathname) Lchmod(mode int)
- func (p *Pathname) Lchown(uid, gid int)
- func (p *Pathname) Lstat() os.FileInfo
- func (p *Pathname) Lutime(atime, mtime time.Time)
- func (p *Pathname) MakeLink(target string)
- func (p *Pathname) MakeSymlink(target string)
- func (p *Pathname) MarshalText() ([]byte, error)
- func (p *Pathname) Mkdir()
- func (p *Pathname) Mkpath()
- func (p *Pathname) Mtime() time.Time
- func (p *Pathname) Open() (*os.File, error)
- func (p *Pathname) Opendir() ([]*Pathname, error)
- func (p *Pathname) Parent() *Pathname
- func (p *Pathname) Read() string
- func (p *Pathname) Readlines() []string
- func (p *Pathname) Readlink() *Pathname
- func (p *Pathname) Realdirpath() *Pathname
- func (p *Pathname) Realpath() *Pathname
- func (p *Pathname) RelativePathFrom(base string) *Pathname
- func (p *Pathname) Rename(dest string)
- func (p *Pathname) Rmdir()
- func (p *Pathname) Rmtree()
- func (p *Pathname) Size() int64
- func (p *Pathname) SizeQ() int64
- func (p *Pathname) SplitPath() []*Pathname
- func (p *Pathname) Stat() os.FileInfo
- func (p *Pathname) String() string
- func (p *Pathname) Sub(pattern, replacement string) *Pathname
- func (p *Pathname) SubExt(ext string) *Pathname
- func (p *Pathname) Sysopen() int
- func (p *Pathname) Taint() *Pathname
- func (p *Pathname) Tainted() bool
- func (p *Pathname) ToPath() string
- func (p *Pathname) Truncate(length int)
- func (p *Pathname) Unlink()
- func (p *Pathname) Untaint() *Pathname
- func (p *Pathname) Utime(atime, mtime time.Time)
- func (p *Pathname) Write(content string)
- type StringScanner
- func (ss *StringScanner) BolP() bool
- func (ss *StringScanner) Captures() []string
- func (ss *StringScanner) Check(pattern *regexp.Regexp) string
- func (ss *StringScanner) CheckUntil(pattern *regexp.Regexp) string
- func (ss *StringScanner) Concat(str string) *StringScanner
- func (ss *StringScanner) EOS() bool
- func (ss *StringScanner) Exist(pattern *regexp.Regexp) int
- func (ss *StringScanner) Getch() string
- func (ss *StringScanner) Inspect() string
- func (ss *StringScanner) MatchSize(pattern *regexp.Regexp) int
- func (ss *StringScanner) Matched() string
- func (ss *StringScanner) MatchedP() bool
- func (ss *StringScanner) MatchedSize() int
- func (ss *StringScanner) NamedCapture(name string) string
- func (ss *StringScanner) NamedCaptures() map[string]string
- func (ss *StringScanner) Peek(n int) string
- func (ss *StringScanner) Pos() int
- func (ss *StringScanner) PostMatch() string
- func (ss *StringScanner) PreMatch() string
- func (ss *StringScanner) Reset() *StringScanner
- func (ss *StringScanner) Rest() string
- func (ss *StringScanner) RestP() bool
- func (ss *StringScanner) RestSize() int
- func (ss *StringScanner) Scan(pattern *regexp.Regexp) string
- func (ss *StringScanner) ScanUntil(pattern *regexp.Regexp) string
- func (ss *StringScanner) SetPos(n int)
- func (ss *StringScanner) SetStr(s string)
- func (ss *StringScanner) Size() int
- func (ss *StringScanner) Skip(pattern *regexp.Regexp) int
- func (ss *StringScanner) SkipUntil(pattern *regexp.Regexp) int
- func (ss *StringScanner) Str() string
- func (ss *StringScanner) Terminate() *StringScanner
- func (ss *StringScanner) Unscan() *StringScanner
- type Tempfile
- func (t *Tempfile) Close()
- func (t *Tempfile) CloseAndUnlink()
- func (t *Tempfile) Flush()
- func (t *Tempfile) Open()
- func (t *Tempfile) Path() string
- func (t *Tempfile) Read() string
- func (t *Tempfile) Rewind() int
- func (t *Tempfile) Size() int
- func (t *Tempfile) Truncate(size int) int
- func (t *Tempfile) Unlink()
- func (t *Tempfile) Write(s string) int
- type TimeoutError
- type URI
- func (u *URI) Absolute() bool
- func (u *URI) Authority() string
- func (u *URI) DecodedPassword() string
- func (u *URI) DecodedUser() string
- func (u *URI) DefaultPort() int
- func (u *URI) Dup() *URI
- func (u *URI) Equal(other *URI) bool
- func (u *URI) Format(f interface{ ... }, _ rune)
- func (u *URI) Fragment() string
- func (u *URI) Freeze() *URI
- func (u *URI) Frozen() bool
- func (u *URI) GoString() string
- func (u *URI) Host() string
- func (u *URI) Hostname() string
- func (u *URI) Inspect() string
- func (u *URI) IsHierarchical() bool
- func (u *URI) MarshalText() ([]byte, error)
- func (u *URI) Merge(other string) *URI
- func (u *URI) Normalize() *URI
- func (u *URI) Opaque() string
- func (u *URI) Origin() string
- func (u *URI) Password() string
- func (u *URI) Path() string
- func (u *URI) Port() int
- func (u *URI) Query() string
- func (u *URI) Relative() bool
- func (u *URI) RequestURI() string
- func (u *URI) RouteFrom(other string) *URI
- func (u *URI) RouteTo(other string) *URI
- func (u *URI) Scheme() string
- func (u *URI) Select(components ...string) []string
- func (u *URI) SetFragment(f string) string
- func (u *URI) SetHost(h string) string
- func (u *URI) SetHostname(h string) string
- func (u *URI) SetPassword(p string) string
- func (u *URI) SetPath(p string) string
- func (u *URI) SetPort(p int) int
- func (u *URI) SetQuery(q string) string
- func (u *URI) SetScheme(s string) string
- func (u *URI) SetUser(name string) string
- func (u *URI) SetUserinfo(info string) string
- func (u *URI) String() string
- func (u *URI) User() string
- func (u *URI) Userinfo() string
- type WeakRef
Constants ¶
const ( OrderPermute = 0 OrderRequire = 1 OrderReturn = 2 )
Ordering constants
Variables ¶
var FindPruneError = os.ErrPermission // reuse as sentinel
FindPruneError is a sentinel error used to skip directories in Find.find.
Functions ¶
func Abbrev ¶
Abbrev computes the set of unambiguous abbreviations for a list of strings. Given ["ruby", "rules"], returns {"rub" => "ruby", "ruby" => "ruby", "rul" => "rules", "rule" => "rules", "rules" => "rules"}.
func AppendNewline ¶
AppendNewline adds a trailing newline, matching Ruby's Base64.encode64 behavior.
func BenchmarkJobItem ¶
func BenchmarkJobItem(label string, f func())
BenchmarkJobItem is a stub for Benchmark::Job#item.
func BenchmarkJobReport ¶
func BenchmarkJobReport()
BenchmarkJobReport is a stub for Benchmark::Job#report.
func BenchmarkJobWidth ¶
func BenchmarkJobWidth() int
BenchmarkJobWidth is a stub for Benchmark::Job#width.
func BenchmarkRealtime ¶
func BenchmarkRealtime(f func()) float64
BenchmarkRealtime executes f and returns the elapsed wall-clock time in seconds. This mirrors Ruby's Benchmark.realtime { }.
func BenchmarkReportReport ¶
func BenchmarkReportReport()
BenchmarkReportReport is a stub for Benchmark::Report#report.
func CurrentFile ¶
func CurrentFile() string
CurrentFile returns the file path of the caller. Used for __dir__.
func CurrentMethodName ¶
func CurrentMethodName() string
CurrentMethodName returns the name of the calling function. Used for __method__.
func DateAsctime ¶
DateAsctime formats like ctime: "Mon Jan 2 00:00:00 2006".
func DateDownto ¶
DateDownto iterates from start down to end, calling fn for each date.
func DateHttpdate ¶
DateHttpdate formats a date for HTTP headers.
func DateISO8601 ¶
DateISO8601 parses an ISO 8601 date string.
func DateISO8601Format ¶
DateISO8601Format formats a date as ISO 8601.
func DateInspect ¶
DateInspect returns the inspect representation.
func DateNextDay ¶
DateNextDay returns the date n days from now.
func DateNextMonth ¶
DateNextMonth returns the date n months from now.
func DateNextYear ¶
DateNextYear returns the date n years from now.
func DatePrevDay ¶
DatePrevDay returns the date n days ago.
func DatePrevMonth ¶
DatePrevMonth returns the date n months ago.
func DatePrevYear ¶
DatePrevYear returns the date n years ago.
func DateShiftMonths ¶
DateShiftMonths shifts by n months (Ruby's << and >> operators).
func DateStrftime ¶
DateStrftime formats a date using a Ruby strftime string.
func DateStrptime ¶
DateStrptime parses a date with a specific format.
func DigestConstMissing ¶
DigestConstMissing is a stub for Digest.const_missing. In Ruby this auto-requires algorithm modules; in Go all algorithms are available at import time.
func DigestHexencode ¶
DigestHexencode encodes a binary string to hex (Digest.hexencode).
func DigestMD5Base64digest ¶
func DigestMD5Digest ¶
func DigestMD5File ¶
func DigestMD5Hexdigest ¶
func DigestSHA1Base64digest ¶
func DigestSHA1Digest ¶
func DigestSHA1File ¶
func DigestSHA1Hexdigest ¶
func DigestSHA256Digest ¶
func DigestSHA256File ¶
func DigestSHA256Hexdigest ¶
func DigestSHA384Digest ¶
func DigestSHA384File ¶
func DigestSHA384Hexdigest ¶
func DigestSHA512Digest ¶
func DigestSHA512File ¶
func DigestSHA512Hexdigest ¶
func DirChildren ¶
DirChildren returns entries of a directory without . and ..
func DirEntries ¶
DirEntries returns the entries of a directory (like . and ..).
func DirMktmpdir ¶
DirMktmpdir creates a temporary directory with the given prefix and returns its path.
func EnvValues ¶
func EnvValues() []string
EnvValues returns a slice of all environment variable values.
func EtcConfstr ¶
EtcConfstr returns a system configuration string. Stubs common POSIX confstr values.
func EtcGetlogin ¶
func EtcGetlogin() string
EtcGetlogin returns the login name of the current user.
func EtcHome ¶
func EtcHome() string
EtcHome returns the home directory of the current user (or the named user).
func EtcHomeForUser ¶
EtcHomeForUser returns the home directory for the specified user.
func EtcNprocessors ¶
func EtcNprocessors() int
EtcNprocessors returns the number of CPUs available.
func EtcSysconf ¶
EtcSysconf returns a system configuration long value. Stubs common POSIX sysconf values.
func EtcSysconfdir ¶
func EtcSysconfdir() string
EtcSysconfdir returns the system configuration directory.
func FileUtilsChdir ¶
func FileUtilsChdir(path string)
FileUtilsChdir changes the current working directory to path.
func FileUtilsChmod ¶
FileUtilsChmod changes the permission bits of path to mode.
func FileUtilsChmodR ¶
FileUtilsChmodR recursively changes permission bits.
func FileUtilsChown ¶
func FileUtilsChown(user, group, path string)
FileUtilsChown changes ownership of a file (no-op on systems without chown).
func FileUtilsChownR ¶
func FileUtilsChownR(user, group, path string)
FileUtilsChownR recursively changes ownership.
func FileUtilsCollectMethod ¶
FileUtilsCollectMethod returns a method proc (stub — returns empty string).
func FileUtilsCommands ¶
func FileUtilsCommands() []string
FileUtilsCommands returns all available FileUtils command names.
func FileUtilsCompareFile ¶
FileUtilsCompareFile returns true if the two files have identical contents.
func FileUtilsCopyEntry ¶
func FileUtilsCopyEntry(src, dst string)
FileUtilsCopyEntry copies a file or directory entry.
func FileUtilsCopyStream ¶
func FileUtilsCopyStream(src, dst string)
FileUtilsCopyStream copies from one IO to another (not directly usable from facade).
func FileUtilsCp ¶
func FileUtilsCp(src, dst string)
func FileUtilsCpLr ¶
func FileUtilsCpLr(src, dst string)
FileUtilsCpLr copies using hard links (falls back to copy).
func FileUtilsHaveOption ¶
FileUtilsHaveOption always returns false (Ruby-specific metadata).
func FileUtilsInstall ¶
func FileUtilsInstall(src, dst string)
FileUtilsInstall copies src to dst and optionally sets permissions.
func FileUtilsLn ¶
func FileUtilsLn(src, dst string)
FileUtilsLn creates a hard link from src to dst.
func FileUtilsLnS ¶
func FileUtilsLnS(src, dst string)
FileUtilsLnS creates a symbolic link dst -> src.
func FileUtilsLnSF ¶
func FileUtilsLnSF(src, dst string)
FileUtilsLnSF creates a symbolic link dst -> src, removing dst first if it exists.
func FileUtilsMkdir ¶
func FileUtilsMkdir(path string)
FileUtilsMkdir creates a single directory (not parents).
func FileUtilsMkdirP ¶
func FileUtilsMkdirP(path string)
func FileUtilsOptions ¶
func FileUtilsOptions() []string
FileUtilsOptions returns available options for a command (stub).
func FileUtilsOptionsOf ¶
FileUtilsOptionsOf returns options for a specific command (stub).
func FileUtilsRemoveEntry ¶
func FileUtilsRemoveEntry(path string)
FileUtilsRemoveEntry removes a file or directory tree.
func FileUtilsRm ¶
func FileUtilsRm(path string)
func FileUtilsRmF ¶
func FileUtilsRmF(path string)
FileUtilsRmF removes a file, ignoring any error (like rm -f).
func FileUtilsRmRf ¶
func FileUtilsRmRf(path string)
func FileUtilsTouch ¶
func FileUtilsTouch(path string)
FileUtilsTouch creates the file if it does not exist and updates its modification time if it does, matching FileUtils.touch behavior.
func FileUtilsUptodate ¶
FileUtilsUptodate returns true if dst is newer than all sources.
func FindCollect ¶
FindCollect walks directory trees and returns all paths found.
func FindPrune ¶
func FindPrune()
FindPrune is a no-op placeholder. In Ruby, Find.prune skips the current directory during Find.find. In our translation, Find.find collects all paths upfront, so prune has no effect.
func GetoptLongEach ¶
func GetoptLongEach(g *GetoptLong, fn func(string, string))
GetoptLongEach iterates over all remaining options, calling fn for each.
func GetoptLongErrorMessage ¶
func GetoptLongErrorMessage(g *GetoptLong) string
GetoptLongErrorMessage returns the current error message.
func GetoptLongGet ¶
func GetoptLongGet(g *GetoptLong) (string, string)
GetoptLongGet returns the next option and its argument (if any). Returns empty strings when all options have been consumed.
func GetoptLongHasError ¶
func GetoptLongHasError(g *GetoptLong) bool
GetoptLongHasError returns whether an error occurred.
func GetoptLongIsQuiet ¶
func GetoptLongIsQuiet(g *GetoptLong) bool
GetoptLongIsQuiet returns the quiet setting.
func GetoptLongIsTerminated ¶
func GetoptLongIsTerminated(g *GetoptLong) bool
GetoptLongIsTerminated returns whether parsing has been terminated.
func GetoptLongOrdering ¶
func GetoptLongOrdering(g *GetoptLong) int
GetoptLongOrdering returns the current ordering mode.
func GetoptLongSetError ¶
func GetoptLongSetError(g *GetoptLong, msg string)
GetoptLongSetError sets an error message on the parser.
func GetoptLongSetOptions ¶
func GetoptLongSetOptions(g *GetoptLong, opts ...any)
GetoptLongSetOptions configures the recognized options. Each option is a name string and a boolean for whether it takes an argument.
func GetoptLongSetOrdering ¶
func GetoptLongSetOrdering(g *GetoptLong, order int)
GetoptLongSetOrdering sets the ordering mode.
func GetoptLongSetQuiet ¶
func GetoptLongSetQuiet(g *GetoptLong, q bool)
GetoptLongSetQuiet sets the quiet mode.
func GetoptLongTerminate ¶
func GetoptLongTerminate(g *GetoptLong)
GetoptLongTerminate marks parsing as terminated.
func IPAddrNtop ¶
IPAddrNtop converts a network-byte-order binary string to a human-readable IP address string. Mirrors Ruby's IPAddr.ntop(binary_string).
func JSONCreateFastState ¶
func JSONCreateFastState() string
JSONCreateFastState returns empty string (internal Ruby state).
func JSONCreatePrettyState ¶
func JSONCreatePrettyState() string
JSONCreatePrettyState returns empty string.
func JSONDeepConstGet ¶
JSONDeepConstGet returns empty string (Ruby-specific).
func JSONDumpDefaultOptions ¶
JSONDumpDefaultOptions returns empty map (config stub).
func JSONGenerate ¶
func JSONGenerate(v interface{}) string
JSONGenerate converts any value to a JSON string. Mirrors Ruby's JSON.generate(obj) and obj.to_json.
func JSONGenerator ¶
func JSONGenerator() string
JSONGenerator returns "json/pure" (Ruby module name stub).
func JSONLoadDefaultOptions ¶
JSONLoadDefaultOptions returns empty map (config stub).
func JSONLoadFile ¶
JSONLoadFile reads a JSON file from disk and parses it into a map[string]string.
func JSONLoadFileStrict ¶
JSONLoadFileStrict is the same as JSONLoadFile (Ruby's load_file!).
func JSONParse ¶
JSONParse parses a JSON string into a map[string]string. Mirrors Ruby's JSON.parse(str) for object inputs. Values are coerced to strings since thanos hashes are homogeneously typed.
func JSONPrettyGenerate ¶
func JSONPrettyGenerate(v interface{}) string
JSONPrettyGenerate converts any value to a pretty-printed JSON string. Mirrors Ruby's JSON.pretty_generate(obj).
func JSONRecurseProc ¶
func JSONRecurseProc(obj, proc string)
JSONRecurseProc is a no-op (applies proc recursively to parsed objects).
func JSONSetCreateID ¶
func JSONSetCreateID(id string)
JSONSetCreateID is a no-op (sets the create_id, unused in Go).
func JSONSetDumpDefaultOptions ¶
JSONSetDumpDefaultOptions is a no-op.
func JSONSetLoadDefaultOptions ¶
JSONSetLoadDefaultOptions is a no-op.
func LoggerAdd ¶
LoggerAdd logs a message at the given Ruby Logger severity level. Ruby severity constants: DEBUG=0, INFO=1, WARN=2, ERROR=3, FATAL=4, UNKNOWN=5
func LoggerFormatterCall ¶
LoggerFormatterCall is a stub for Logger::Formatter#call.
func LoggerFormatterDatetimeFormat ¶
func LoggerFormatterDatetimeFormat() string
LoggerFormatterDatetimeFormat is a stub for Logger::Formatter#datetime_format.
func LoggerFormatterSetDatetimeFormat ¶
LoggerFormatterSetDatetimeFormat is a stub for Logger::Formatter#datetime_format=.
func LoggerLogDeviceClose ¶
func LoggerLogDeviceClose()
LoggerLogDeviceClose is a stub for Logger::LogDevice#close.
func LoggerLogDeviceDev ¶
func LoggerLogDeviceDev() string
LoggerLogDeviceDev is a stub for Logger::LogDevice#dev.
func LoggerLogDeviceFilename ¶
func LoggerLogDeviceFilename() string
LoggerLogDeviceFilename is a stub for Logger::LogDevice#filename.
func LoggerLogDeviceReopen ¶
func LoggerLogDeviceReopen()
LoggerLogDeviceReopen is a stub for Logger::LogDevice#reopen.
func LoggerLogDeviceWrite ¶
func LoggerLogDeviceWrite(msg string)
LoggerLogDeviceWrite is a stub for Logger::LogDevice#write.
func LoggerPeriodNextRotateTime ¶
func LoggerPeriodNextRotateTime() string
LoggerPeriodNextRotateTime is a stub for Logger::Period.next_rotate_time.
func LoggerPeriodPreviousPeriodEnd ¶
func LoggerPeriodPreviousPeriodEnd() string
LoggerPeriodPreviousPeriodEnd is a stub for Logger::Period.previous_period_end.
func MutexAppendFeatures ¶
func MutexAppendFeatures(m *MutexM)
MutexAppendFeatures is a no-op hook (Ruby module callback).
func MutexDefineAliases ¶
func MutexDefineAliases(m *MutexM)
MutexDefineAliases is a no-op hook (Ruby module callback).
func MutexExtendObject ¶
func MutexExtendObject(m *MutexM)
MutexExtendObject is a no-op hook (Ruby module callback).
func MutexExtended ¶
func MutexExtended(m *MutexM)
MutexExtended is a no-op callback invoked when Mutex_m is mixed into a module.
func MutexIsLocked ¶
MutexIsLocked returns whether the mutex is currently locked.
func MutexSleep ¶
MutexSleep releases the lock, sleeps for the given duration, then reacquires.
func MutexSynchronize ¶
func MutexSynchronize(m *MutexM, fn func())
MutexSynchronize executes fn while holding the lock.
func MutexTryLock ¶
MutexTryLock attempts to acquire the mutex without blocking. Returns true if the lock was acquired, false otherwise.
func ObservableAddObserver ¶
func ObservableAddObserver(o *Observable, name string, fn func(...any))
ObservableAddObserver adds a named observer callback.
func ObservableCountObservers ¶
func ObservableCountObservers(o *Observable) int
ObservableCountObservers returns the number of registered observers.
func ObservableDeleteObserver ¶
func ObservableDeleteObserver(o *Observable, name string)
ObservableDeleteObserver removes a named observer.
func ObservableDeleteObservers ¶
func ObservableDeleteObservers(o *Observable)
ObservableDeleteObservers removes all observers.
func ObservableIsChanged ¶
func ObservableIsChanged(o *Observable) bool
ObservableIsChanged returns whether the observable has been marked changed.
func ObservableNotifyObservers ¶
func ObservableNotifyObservers(o *Observable, args ...any)
ObservableNotifyObservers notifies all observers if the observable is changed, then clears the changed flag.
func ObservableSetChanged ¶
func ObservableSetChanged(o *Observable)
ObservableSetChanged marks the observable as changed.
func Open3Capture2 ¶
Open3Capture2 runs a command and returns [stdout, status].
func Open3Capture2e ¶
Open3Capture2e runs a command and returns [combined_output, status].
func Open3Capture3 ¶
Open3Capture3 runs a command and returns [stdout, stderr, status].
func Open3Pipeline ¶
Open3Pipeline runs a pipeline of commands, returns array of exit statuses.
func Open3PipelineR ¶
Open3PipelineR runs a pipeline and returns the final stdout.
func Open3PipelineRW ¶
Open3PipelineRW runs a pipeline and returns final output.
func Open3PipelineStart ¶
Open3PipelineStart starts a pipeline (same as Pipeline).
func Open3PipelineW ¶
Open3PipelineW runs a pipeline (same as Pipeline).
func Open3Popen2 ¶
Open3Popen2 simplified — returns [stdout, status].
func Open3Popen2e ¶
Open3Popen2e simplified — returns [combined, status].
func Open3Popen3 ¶
Open3Popen3 simplified — runs command synchronously, returns [stdout, stderr, status].
func OpenURIBaseURI ¶
OpenURIBaseURI returns the URL that was fetched.
func OpenURICharset ¶
OpenURICharset returns the charset from the Content-Type header.
func OpenURIContentEncoding ¶
OpenURIContentEncoding returns the content encoding(s) from the response.
func OpenURIContentType ¶
OpenURIContentType returns the Content-Type header from fetching the URL.
func OpenURILastModified ¶
OpenURILastModified returns the Last-Modified header value.
func OpenURIMeta ¶
OpenURIMeta returns all response headers as a map.
func OpenURIOpen ¶
OpenURIOpen is an alias for OpenURIRead (Ruby's Kernel#open with URI).
func OpenURIRead ¶
OpenURIRead fetches the URL and returns the body as a *bytes.Buffer. This mirrors Ruby's OpenURI.open_uri(url) which returns a StringIO-like IO. Returning *bytes.Buffer lets the result support StringIO methods like .read.
func OpenURIReadBody ¶
OpenURIReadBody fetches the URL and returns the body as a string.
func OpenURIStatus ¶
OpenURIStatus returns [status_code, message] as a two-element string slice.
func PPGenspace ¶
PPGenspace returns n spaces (PrettyPrint default genspace).
func PPNewline ¶
func PPNewline() string
PPNewline returns a newline string (PrettyPrint default newline).
func PPSetSharingDetection ¶
func PPSetSharingDetection(v bool)
PPSetSharingDetection sets the sharing detection flag.
func PPSharingDetection ¶
func PPSharingDetection() bool
PPSharingDetection returns the current sharing detection flag.
func PPWidthFor ¶
PPWidthFor returns a display width for the given output. In Ruby this computes terminal width; here we default to 79.
func ProcessClockGettime ¶
func ProcessClockGettime() float64
ProcessClockGettime returns the current monotonic clock time as a float64 of seconds.
func ProcessGroups ¶
func ProcessGroups() []int
ProcessGroups returns the supplementary group IDs of the calling process.
func ProcessKill ¶
ProcessKill sends a signal to a process. Signal can be int or string.
func ProcessSpawn ¶
ProcessSpawn starts a command and returns its PID.
func ProcessWait ¶
func ProcessWait() int
ProcessWait waits for any child process and returns its PID.
func RandomBytes ¶
RandomBytes generates n random bytes from the given rand.Rand and returns as string.
func RegexpCasefold ¶
RegexpCasefold returns true if the regexp has the case-insensitive flag.
func RegexpNamedCaptures ¶
RegexpNamedCaptures returns a map of capture group names to their indices.
func RegexpUnion ¶
RegexpUnion creates a regexp that matches any of the given patterns.
func SecureRandomAlphanumeric ¶
SecureRandomAlphanumeric generates a random alphanumeric string. n is the length (default 16).
func SecureRandomBase64 ¶
SecureRandomBase64 generates a random base64 string. n is the number of random bytes (default 16).
func SecureRandomBytes ¶
SecureRandomBytes generates n random bytes.
func SecureRandomHex ¶
SecureRandomHex generates a random hex string. n is the number of random bytes (default 16); the hex output is 2*n chars.
func SecureRandomNumber ¶
SecureRandomNumber generates a random number. With no args: returns a float in [0, 1). With an int arg: returns an int in [0, n). With a float arg: returns a float in [0, n).
func SecureRandomURLSafeBase64 ¶
SecureRandomURLSafeBase64 generates a random URL-safe base64 string. n is the number of random bytes (default 16).
func SecureRandomUUID ¶
func SecureRandomUUID() string
SecureRandomUUID generates a random v4 UUID string.
func ShellEscape ¶
ShellEscape escapes a string for safe use in a shell command. Implements Ruby's Shellwords.escape / shellescape.
func ShellJoin ¶
ShellJoin joins an array of strings into a shell-safe command. Implements Ruby's Shellwords.join / shelljoin.
func ShellSplit ¶
ShellSplit splits a command-line string into words, respecting quotes. Implements Ruby's Shellwords.split / shellsplit / shellwords.
func SingletonClone ¶
SingletonClone returns the receiver (Singleton#clone raises in Ruby; in Go we just return self).
func SingletonDump ¶
SingletonDump returns an empty string (serialization stub).
func SingletonDup ¶
SingletonDup returns the receiver (Singleton#dup raises in Ruby; in Go we just return self).
func SingletonIncluded ¶
func SingletonIncluded(obj any)
SingletonIncluded is a no-op hook called when Singleton is included in a class.
func SingletonInstance ¶
SingletonInstance returns the receiver itself (no-op in Go).
func SingletonLoad ¶
SingletonLoad returns nil (deserialization stub).
func StringIOGetbyte ¶
StringIOGetbyte reads one byte from buf as an integer. Returns -1 at EOF.
func StringIOGetc ¶
StringIOGetc reads one character (byte) from buf. Returns empty string at EOF.
func StringIOGets ¶
StringIOGets reads until the next newline (inclusive). Returns empty string at EOF.
func StringIOPutc ¶
StringIOPutc writes one character to buf and returns it.
func StringIOReadlines ¶
StringIOReadlines returns all remaining content split into lines. Each line includes its trailing newline, except possibly the last line if the content does not end with a newline.
func StringIOUngetbyte ¶
StringIOUngetbyte pushes a byte back to the front of the buffer.
func StringIOUngetc ¶
StringIOUngetc pushes a character back to the front of the buffer.
func SyslogConstantsIncluded ¶
func SyslogConstantsIncluded()
SyslogConstantsIncluded is a no-op stub for Syslog::Constants.included hook.
func SyslogInspect ¶
func SyslogInspect() string
SyslogInspect returns a description string for the Syslog connection.
func SyslogInstance ¶
func SyslogInstance() string
SyslogInstance returns the ident of the current syslog connection. Mirrors Ruby's Syslog.instance (returns Syslog itself; here we return ident as a proxy since Go has no module-as-value semantics).
func SyslogLog ¶
SyslogLog logs a message at an arbitrary priority level. Mirrors Ruby's Syslog.log(level, msg).
func SyslogLogMask ¶
SyslogLogMask computes the log mask bit for a single priority level. Mirrors Ruby's Syslog::Macros#LOG_MASK(pri) → 1 << pri.
func SyslogLogUpTo ¶
SyslogLogUpTo computes the log mask for all priorities up to and including pri. Mirrors Ruby's Syslog::Macros#LOG_UPTO(pri) → (1 << (pri+1)) - 1.
func SyslogMacrosIncluded ¶
func SyslogMacrosIncluded()
SyslogMacrosIncluded is a no-op stub for Syslog::Macros.included hook.
func SyslogNotice ¶
func SyslogNotice(msg string)
SyslogNotice logs a message at LOG_NOTICE priority.
func SyslogOpen ¶
SyslogOpen opens a connection to the system logger. Mirrors Ruby's Syslog.open(ident, options=0, facility=LOG_USER).
func SyslogOpened ¶
func SyslogOpened() bool
SyslogOpened returns true if the syslog connection is open.
func SyslogSetMask ¶
SyslogSetMask sets the log priority mask and returns the previous mask.
func SyslogWarning ¶
func SyslogWarning(msg string)
SyslogWarning logs a message at LOG_WARNING priority.
func Timeout ¶
func Timeout(seconds float64, fn func())
Timeout runs fn with a timeout of seconds. Panics with TimeoutError if exceeded.
func TimeoutErrorMessage ¶
func TimeoutErrorMessage(e *TimeoutError) string
TimeoutErrorMessage returns the error message from a TimeoutError.
func TmsToA ¶
func TmsToA(t *BenchmarkTms) []float64
TmsToA returns the Tms fields as a slice: [label, utime, stime, cutime, cstime, real]. The label is represented as 0.0 since this returns []float64 (the label field in Ruby's to_a is a string, but thanos simplifies to float64 array).
func TmsToH ¶
func TmsToH(t *BenchmarkTms) map[string]float64
TmsToH returns the Tms fields as a map.
func ToFloat ¶
func ToFloat(val interface{}) float64
ToFloat converts a value to float64, similar to Ruby's Float().
func ToInteger ¶
func ToInteger(val interface{}) int
ToInteger converts a value to int, similar to Ruby's Integer().
func TsortDo ¶
TsortDo performs a topological sort given two iterator functions. eachNode iterates over all nodes by calling its argument for each one. eachChild iterates over the children of a node by calling its argument for each child. Returns nodes in topological order (dependencies before dependents). Panics if the graph has a cycle (matching Ruby's TSort::Cyclic error).
func TsortFromHash ¶
TsortFromHash performs a topological sort on a hash where keys depend on their values. The hash maps each node to a slice of its dependencies.
func TsortSCCDo ¶
TsortSCCDo computes strongly connected components using Kosaraju's algorithm. eachNode iterates over all nodes; eachChild iterates over children of a node. Returns a slice of SCCs, each SCC is a slice of nodes, ordered so that dependencies come before dependents (matching Ruby's TSort#strongly_connected_components).
func TsortSCCFromDo ¶
func TsortSCCFromDo(node string, eachNode func(func(string)), eachChild func(string, func(string))) [][]string
TsortSCCFromDo computes strongly connected components that contain a specific node, using the provided iterator functions (for the mixin's each_strongly_connected_component_from).
func TsortSCCFromHash ¶
TsortSCCFromHash computes strongly connected components from a dependency hash.
func TsortSCCFromNode ¶
TsortSCCFromNode computes the SCC containing a specific node from a dependency hash.
func URIBuildQuery ¶
URIBuildQuery builds a query string from parts.
func URIDecodeComponent ¶
URIDecodeComponent decodes a percent-encoded URI component string.
func URIDecodeWwwForm ¶
URIDecodeWwwForm decodes a query string into key-value pairs.
func URIEncodeComponent ¶
URIEncodeComponent encodes a string as a URI component (RFC 3986 §2.1). Unreserved chars (A-Za-z0-9 - _ . ~) are kept; everything else is percent-encoded.
func URIEncodeWwwForm ¶
func URIEncodeWwwForm(m *stdlib.OrderedMap[string, string]) string
URIEncodeWwwForm encodes a hash as application/x-www-form-urlencoded. Takes an OrderedMap[string, string] and returns the encoded string.
func URIEncodeWwwFormFromPairs ¶
Small helper: URIEncodeWwwFormFromPairs handles Ruby's array-of-arrays form
func URIGetEncoding ¶
URIGetEncoding returns the encoding for a given charset (stub).
func URIRegexp ¶
func URIRegexp() string
URIRegexp returns a simple URI-matching regexp pattern string.
func URIRegisterScheme ¶
func URIRegisterScheme(scheme, klass string)
URIRegisterScheme is a no-op (registers a URI scheme handler).
func URISchemeList ¶
URISchemeList returns known URI schemes.
func URISplit ¶
URISplit splits a URI string into components: [scheme, userinfo, host, port, registry, path, opaque, query, fragment].
func URIUnescape ¶
URIUnescape is an alias for URI.decode_www_form_component (deprecated in Ruby).
func WeakRefAlive ¶
WeakRefAlive always returns true in Go (no weak references).
func WeakRefSetObj ¶
WeakRefSetObj replaces the wrapped object.
func YAMLDomainTypes ¶
YAMLDomainTypes returns empty map (stub).
func YAMLDump ¶
func YAMLDump(v interface{}) string
YAMLDump serializes a Go value to a YAML string. Prepends "--- " to match Ruby's YAML.dump output format.
func YAMLDumpStream ¶
func YAMLDumpStream(objects ...interface{}) string
YAMLDumpStream dumps multiple objects as a YAML stream.
func YAMLLibyamlVersion ¶
func YAMLLibyamlVersion() string
YAMLLibyamlVersion returns the libyaml version (stub).
func YAMLLoad ¶
func YAMLLoad(s string) interface{}
YAMLLoad parses a YAML string and returns the result as a Go interface{}. For simple scalar values, returns string. For complex structures, returns map[string]interface{} or []interface{}.
func YAMLLoadFile ¶
func YAMLLoadFile(filename string) interface{}
YAMLLoadFile reads and parses a YAML file.
func YAMLLoadStream ¶
func YAMLLoadStream(s string) interface{}
YAMLLoadStream parses a YAML stream (simplified: parses first document).
func YAMLParse ¶
func YAMLParse(s string) interface{}
YAMLParse parses YAML and returns the raw structure (same as Load for our purposes).
func YAMLParseFile ¶
func YAMLParseFile(filename string) interface{}
YAMLParseFile parses a YAML file.
func YAMLParseStream ¶
func YAMLParseStream(s string) interface{}
YAMLParseStream is the same as LoadStream.
func YAMLSafeDump ¶
func YAMLSafeDump(v interface{}) string
YAMLSafeDump is the same as YAMLDump (Go yaml.v3 is always safe).
func YAMLSafeLoadFile ¶
func YAMLSafeLoadFile(filename string) interface{}
YAMLSafeLoadFile is the same as YAMLLoadFile.
func YAMLSetDomainTypes ¶
YAMLSetDomainTypes is a no-op.
func YAMLToJSON ¶
func YAMLToJSON(v interface{}) string
YAMLToJSON converts a YAML value to JSON string.
func YAMLUnsafeLoad ¶
func YAMLUnsafeLoad(s string) interface{}
YAMLUnsafeLoad is the same as YAMLLoad (no unsafe distinction in Go).
func YAMLUnsafeLoadFile ¶
func YAMLUnsafeLoadFile(filename string) interface{}
YAMLUnsafeLoadFile is the same as YAMLLoadFile.
func ZlibAdler32 ¶
ZlibAdler32 computes the Adler-32 checksum of the given string.
func ZlibAdler32Combine ¶
ZlibAdler32Combine combines two Adler-32 checksums.
func ZlibBestCompression ¶
func ZlibBestCompression() int
ZlibBestCompression returns the best compression level constant.
func ZlibBestSpeed ¶
func ZlibBestSpeed() int
ZlibBestSpeed returns the best speed compression level constant.
func ZlibCompress ¶
ZlibCompress compresses a string using zlib (not raw deflate).
func ZlibCrc32Combine ¶
ZlibCrc32Combine combines two CRC-32 checksums.
func ZlibCrcTable ¶
func ZlibCrcTable() string
ZlibCrcTable returns the CRC-32 polynomial table as a string representation.
func ZlibDefaultCompression ¶
func ZlibDefaultCompression() int
ZlibDefaultCompression returns the default compression level constant.
func ZlibDeflate ¶
ZlibDeflate compresses a string using zlib/deflate.
func ZlibDeflateLevel ¶
ZlibDeflateLevel compresses with a specified compression level (0-9).
func ZlibGunzip ¶
ZlibGunzip decompresses a gzip-compressed string.
func ZlibGzipLevel ¶
ZlibGzipLevel compresses using gzip with a specified compression level.
func ZlibInflate ¶
ZlibInflate decompresses a deflate-compressed string.
func ZlibNoCompression ¶
func ZlibNoCompression() int
ZlibNoCompression returns the no-compression level constant.
func ZlibUncompress ¶
ZlibUncompress decompresses a zlib-compressed string.
func ZlibVersion ¶
func ZlibVersion() string
ZlibVersion returns the zlib version string. Go doesn't expose the underlying C zlib version, so we return the Go compress version.
Types ¶
type BenchmarkTms ¶
type BenchmarkTms struct {
Label string
Utime float64 // user CPU time (approximated as real time)
Stime float64 // system CPU time (approximated as 0)
CUtime float64 // children user CPU time
CStime float64 // children system CPU time
Real float64 // real (wall-clock) elapsed time in seconds
}
BenchmarkTms holds the timing result of a single Benchmark.measure call. It mirrors Ruby's Benchmark::Tms struct, though on most platforms utime/stime are not obtainable without cgo, so they default to the real elapsed time.
func BenchmarkBenchmark ¶
func BenchmarkBenchmark(f func()) []*BenchmarkTms
BenchmarkBenchmark runs a block and returns an empty slice of Tms results. The block is expected to use Benchmark::Report#item internally, but since we don't model the report object, this just executes the block.
func BenchmarkJobList ¶
func BenchmarkJobList() []*BenchmarkTms
BenchmarkJobList is a stub for Benchmark::Job#list.
func BenchmarkMeasure ¶
func BenchmarkMeasure(label string, f func()) *BenchmarkTms
BenchmarkMeasure executes f, measures elapsed time, and returns a BenchmarkTms. utime/stime are approximated: real time is used for utime, stime is 0.
func BenchmarkReportItem ¶
func BenchmarkReportItem(label string, f func()) *BenchmarkTms
BenchmarkReportItem is a stub for Benchmark::Report#item.
func BenchmarkReportList ¶
func BenchmarkReportList() []*BenchmarkTms
BenchmarkReportList is a stub for Benchmark::Report#list.
func TmsAdd ¶
func TmsAdd(a, b *BenchmarkTms) *BenchmarkTms
TmsAdd adds two BenchmarkTms structs and returns a new one.
func TmsDiv ¶
func TmsDiv(a *BenchmarkTms, s float64) *BenchmarkTms
TmsDiv divides a BenchmarkTms by a scalar.
func TmsMul ¶
func TmsMul(a *BenchmarkTms, s float64) *BenchmarkTms
TmsMul multiplies a BenchmarkTms by a scalar.
func TmsSub ¶
func TmsSub(a, b *BenchmarkTms) *BenchmarkTms
TmsSub subtracts one BenchmarkTms from another.
func (*BenchmarkTms) Inspect ¶
func (t *BenchmarkTms) Inspect() string
Inspect formats the Tms with label like Ruby's Benchmark::Tms#to_s with label.
func (*BenchmarkTms) TmsCStime ¶
func (t *BenchmarkTms) TmsCStime() float64
TmsCStime returns children system CPU time.
func (*BenchmarkTms) TmsCUtime ¶
func (t *BenchmarkTms) TmsCUtime() float64
TmsCUtime returns children user CPU time.
func (*BenchmarkTms) TmsLabel ¶
func (t *BenchmarkTms) TmsLabel() string
TmsLabel returns the label string.
func (*BenchmarkTms) TmsReal ¶
func (t *BenchmarkTms) TmsReal() float64
TmsReal returns the real elapsed time.
func (*BenchmarkTms) TmsStime ¶
func (t *BenchmarkTms) TmsStime() float64
TmsStime returns system CPU time.
func (*BenchmarkTms) TmsUtime ¶
func (t *BenchmarkTms) TmsUtime() float64
TmsUtime returns user CPU time.
func (*BenchmarkTms) ToS ¶
func (t *BenchmarkTms) ToS() string
ToS formats the Tms like Ruby's Benchmark::Tms#to_s: " u s cu cs real"
func (*BenchmarkTms) Total ¶
func (t *BenchmarkTms) Total() float64
Total returns utime + stime, matching Ruby's Benchmark::Tms#total.
type DigestInstance ¶
type DigestInstance struct {
// contains filtered or unexported fields
}
DigestInstance wraps a hash.Hash for Ruby's incremental Digest instance API. Ruby usage: d = Digest::MD5.new; d.update("data"); d.hexdigest
func NewDigestMD5 ¶
func NewDigestMD5() *DigestInstance
func NewDigestSHA1 ¶
func NewDigestSHA1() *DigestInstance
func NewDigestSHA256 ¶
func NewDigestSHA256() *DigestInstance
func NewDigestSHA384 ¶
func NewDigestSHA384() *DigestInstance
func NewDigestSHA512 ¶
func NewDigestSHA512() *DigestInstance
func (*DigestInstance) AppendBytes ¶
func (d *DigestInstance) AppendBytes(data []byte) *DigestInstance
AppendBytes feeds a byte slice into the hash and returns self (for Ruby's << operator).
func (*DigestInstance) Base64digest ¶
func (d *DigestInstance) Base64digest() string
Base64digest returns the Base64-encoded digest without resetting.
func (*DigestInstance) Base64digestBang ¶
func (d *DigestInstance) Base64digestBang() string
Base64digestBang returns the Base64 digest and resets the hash state.
func (*DigestInstance) BlockSize ¶
func (d *DigestInstance) BlockSize() int
BlockSize returns the hash's block size in bytes (Ruby: block_length).
func (*DigestInstance) DigestBytes ¶
func (d *DigestInstance) DigestBytes() string
DigestBytes returns the raw binary digest without resetting.
func (*DigestInstance) DigestBytesBang ¶
func (d *DigestInstance) DigestBytesBang() string
DigestBytesBang returns the raw binary digest and resets the hash state.
func (*DigestInstance) DigestSize ¶
func (d *DigestInstance) DigestSize() int
DigestSize returns the number of bytes in the digest output (Ruby: length / size / digest_length).
func (*DigestInstance) Equal ¶
func (d *DigestInstance) Equal(other *DigestInstance) bool
Equal returns true if other has the same hex digest (Ruby: ==).
func (*DigestInstance) File ¶
func (d *DigestInstance) File(path string) *DigestInstance
File reads the file at path and feeds its content into the hash (Ruby: file).
func (*DigestInstance) Hexdigest ¶
func (d *DigestInstance) Hexdigest() string
Hexdigest returns the hex-encoded digest of data fed so far without resetting.
func (*DigestInstance) HexdigestBang ¶
func (d *DigestInstance) HexdigestBang() string
HexdigestBang returns the hex digest and resets the hash state.
func (*DigestInstance) Inspect ¶
func (d *DigestInstance) Inspect() string
Inspect returns a Ruby-style inspect string.
func (*DigestInstance) New ¶
func (d *DigestInstance) New() *DigestInstance
New returns a fresh DigestInstance of the same algorithm (Ruby: Digest::Instance#new).
func (*DigestInstance) Reset ¶
func (d *DigestInstance) Reset() *DigestInstance
Reset clears all data fed so far and returns self.
func (*DigestInstance) ToS ¶
func (d *DigestInstance) ToS() string
ToS returns the hex digest string (Ruby: to_s).
func (*DigestInstance) Update ¶
func (d *DigestInstance) Update(data string) *DigestInstance
Update feeds data into the hash and returns self for chaining (Ruby: update / <<).
type ERB ¶
ERB provides a simple template engine that maps Ruby's ERB to Go's text/template. Note: real ERB uses <% %> tags; this shim expects Go template syntax {{ }} since the transpiler converts template strings.
func (*ERB) MakeCompiler ¶
MakeCompiler returns the compiler class name (compatibility stub).
func (*ERB) ResultWithHash ¶
ResultWithHash executes the template with a data map and returns the result.
func (*ERB) SetEoutvar ¶
SetEoutvar sets the output variable name (no-op in Go shim; for compatibility).
func (*ERB) SetFilename ¶
SetFilename sets the filename for the ERB template.
type EtcGroupEntry ¶
EtcGroupEntry represents a group database entry.
func EtcGetgrent ¶
func EtcGetgrent() *EtcGroupEntry
EtcGetgrent returns the next group entry (stub: returns current user's group).
func EtcGetgrnam ¶
func EtcGetgrnam(name string) *EtcGroupEntry
EtcGetgrnam looks up a group by name.
func EtcGroup ¶
func EtcGroup() *EtcGroupEntry
EtcGroup returns the current user's group entry (simulates Etc.group without block).
func (*EtcGroupEntry) String ¶
func (e *EtcGroupEntry) String() string
type EtcPasswdEntry ¶
type EtcPasswdEntry struct {
Name string
Passwd string
UID int
GID int
Gecos string
Dir string
Shell string
}
EtcPasswdEntry represents a password database entry.
func EtcGetpwent ¶
func EtcGetpwent() *EtcPasswdEntry
EtcGetpwent returns the next password entry (stub: returns current user).
func EtcGetpwnam ¶
func EtcGetpwnam(name string) *EtcPasswdEntry
EtcGetpwnam looks up a user by name.
func EtcPasswd ¶
func EtcPasswd() *EtcPasswdEntry
EtcPasswd returns the current user's passwd entry (simulates Etc.passwd without block).
func (*EtcPasswdEntry) String ¶
func (e *EtcPasswdEntry) String() string
type GetoptLong ¶
type GetoptLong struct {
// contains filtered or unexported fields
}
GetoptLong provides a simple option parser that maps Ruby's GetoptLong to a Go-native argument parser. This is a basic implementation that handles long options with optional arguments.
type IPAddr ¶
type IPAddr struct {
// contains filtered or unexported fields
}
IPAddr wraps a Go net.IP plus an optional mask, mirroring Ruby's IPAddr. Both single addresses (mask all-ones) and CIDR networks are represented.
func NewIPAddr ¶
NewIPAddr parses a string in IP or CIDR notation (e.g. "192.168.1.1", "192.168.0.0/24", "::1", "2001:db8::/32").
func NewIPAddrNtoh ¶
NewIPAddrNtoh creates an IPAddr from a network-byte-order binary string. Mirrors Ruby's IPAddr.new_ntoh(binary_string).
func (*IPAddr) Compare ¶
Compare compares two IPAddr values lexicographically by address bytes. Returns -1, 0, or 1.
func (*IPAddr) Family ¶
Family returns the address family: syscall.AF_INET for IPv4, syscall.AF_INET6 for IPv6. This matches Ruby's IPAddr#family which returns Socket::AF_INET or Socket::AF_INET6.
func (*IPAddr) Hton ¶
Hton returns the binary representation of the IP address in network byte order.
func (*IPAddr) Inspect ¶
Inspect returns the Ruby-style inspect string, e.g. "#<IPAddr: IPv4:192.168.1.1/255.255.255.255>" or "#<IPAddr: IPv6:0000:0000:0000:0000:0000:0000:0000:0001/ffff:ffff:...>".
func (*IPAddr) Ip6Int ¶
Ip6Int returns the deprecated ip6.int reverse-lookup name for an IPv6 address.
func (*IPAddr) Ipv4Compat ¶
Ipv4Compat returns the deprecated IPv4-compatible IPv6 form of an IPv4 address. For ::1.2.3.4 format (prefix all-zeros, not ffff).
func (*IPAddr) Ipv4Mapped ¶
Ipv4Mapped returns the IPv4-mapped IPv6 form (::ffff:a.b.c.d) of an IPv4 address.
func (*IPAddr) IsIPv4Compat ¶
IsIPv4Compat reports the deprecated IPv4-compatible form. An IPv6 address is IPv4-compatible when its first 12 bytes are all zero and the last 4 bytes represent a value greater than 1 (excluding :: and ::1).
func (*IPAddr) IsIPv4Mapped ¶
IsIPv4Mapped returns true if the address is an IPv4-mapped IPv6 address.
func (*IPAddr) IsLinkLocal ¶
IsLinkLocal returns true if the address is a link-local unicast address.
func (*IPAddr) IsLoopback ¶
IsLoopback returns true if the address is a loopback address.
func (*IPAddr) Native ¶
Native converts an IPv4-mapped IPv6 address to plain IPv4; otherwise returns self.
func (*IPAddr) Reverse ¶
Reverse returns the reverse-DNS lookup name for the address. IPv4: "1.0.168.192.in-addr.arpa", IPv6: full nibble form + ".ip6.arpa"
func (*IPAddr) SetAddr ¶
SetAddr parses a new address string and replaces the current address in-place.
func (*IPAddr) ShiftLeft ¶
ShiftLeft shifts the IP address integer left by n bits, returning a host address. Mirrors Ruby's IPAddr#<< operator.
func (*IPAddr) ShiftRight ¶
ShiftRight shifts the IP address integer right by n bits, returning a host address. Mirrors Ruby's IPAddr#>> operator.
func (*IPAddr) String ¶
String returns the canonical string form of the IP address. For IPv4-mapped (::ffff:a.b.c.d) and IPv4-compat (::a.b.c.d) addresses, Go's net.IP.String() collapses them to just the IPv4 part, so we override.
func (*IPAddr) ToI ¶
ToI returns the IP address as a *big.Int (Ruby returns an arbitrary-precision integer).
func (*IPAddr) ToInt ¶
ToInt returns the IP address as a *big.Int (Ruby's to_i). Alias for ToI; ToI is used internally by ShiftLeft/ShiftRight.
func (*IPAddr) ToRange ¶
ToRange returns the first and last addresses of the network as a two-element slice [first, last]. This is used by the compiler to translate IPAddr#to_range.
type MutexM ¶
type MutexM struct {
// contains filtered or unexported fields
}
MutexM wraps sync.Mutex to implement Ruby's Mutex_m mixin.
type Observable ¶
type Observable struct {
// contains filtered or unexported fields
}
Observable implements Ruby's Observer pattern (Observable mixin) as a Go helper. Observers are tracked by string key mapped to callback functions.
func NewObservable ¶
func NewObservable() *Observable
NewObservable creates a new Observable instance.
type OpenStruct ¶
type OpenStruct struct {
// contains filtered or unexported fields
}
OpenStruct emulates Ruby's OpenStruct using a map[string]interface{}.
func NewOpenStruct ¶
func NewOpenStruct(attrs map[string]interface{}) *OpenStruct
NewOpenStruct creates an OpenStruct, optionally initialized from a map.
func NewOpenStructEmpty ¶
func NewOpenStructEmpty() *OpenStruct
NewOpenStructEmpty creates an empty OpenStruct.
func (*OpenStruct) DeleteField ¶
func (o *OpenStruct) DeleteField(key string) interface{}
DeleteField removes a field and returns its value.
func (*OpenStruct) EachPair ¶
func (o *OpenStruct) EachPair(fn func(string, interface{}))
EachPair iterates over key-value pairs, calling fn for each.
func (*OpenStruct) Eql ¶
func (o *OpenStruct) Eql(other *OpenStruct) bool
Eql checks structural equality with another OpenStruct.
func (*OpenStruct) Freeze ¶
func (o *OpenStruct) Freeze() *OpenStruct
Freeze marks the OpenStruct as frozen.
func (*OpenStruct) Get ¶
func (o *OpenStruct) Get(key string) interface{}
Get retrieves an attribute by name (for [] access).
func (*OpenStruct) GetString ¶
func (o *OpenStruct) GetString(key string) string
GetString retrieves an attribute as a string.
func (*OpenStruct) Hash ¶
func (o *OpenStruct) Hash() int
Hash returns a hash code for the OpenStruct.
func (*OpenStruct) Inspect ¶
func (o *OpenStruct) Inspect() string
Inspect returns a detailed string representation.
func (*OpenStruct) IsFrozen ¶
func (o *OpenStruct) IsFrozen() bool
IsFrozen returns whether the OpenStruct is frozen.
func (*OpenStruct) MarshalDump ¶
func (o *OpenStruct) MarshalDump() map[string]interface{}
MarshalDump returns the attributes map for serialization.
func (*OpenStruct) MarshalLoad ¶
func (o *OpenStruct) MarshalLoad(data map[string]interface{})
MarshalLoad restores attributes from a map.
func (*OpenStruct) RespondTo ¶
func (o *OpenStruct) RespondTo(method string) bool
RespondTo returns true if the OpenStruct has the given attribute or method.
func (*OpenStruct) Set ¶
func (o *OpenStruct) Set(key string, value interface{})
Set sets an attribute by name (for []= access).
func (*OpenStruct) ToH ¶
func (o *OpenStruct) ToH() map[string]interface{}
ToH returns the attributes as a map.
type OpenURIResponse ¶
type OpenURIResponse struct {
Body string
ContentType string
Charset string
StatusCode int
StatusMsg string
BaseURI string
Headers map[string]string
}
OpenURIResponse holds the result of an open-uri HTTP fetch.
type OptionParser ¶
type OptionParser struct {
Banner string
Version string
ProgramName string
// contains filtered or unexported fields
}
OptionParser provides a simple option parser that maps Ruby's OptionParser.
func NewOptionParser ¶
func NewOptionParser() *OptionParser
NewOptionParser creates a new OptionParser.
func NewOptionParserWithBanner ¶
func NewOptionParserWithBanner(banner string) *OptionParser
NewOptionParserWithBanner creates a new OptionParser with a custom banner.
func (*OptionParser) Accept ¶
func (op *OptionParser) Accept(_ string)
Accept is a no-op compatibility stub (type coercion registry).
func (*OptionParser) Getopts ¶
func (op *OptionParser) Getopts(args []string, specs []string) map[string]string
Getopts is a simplified interface: returns a map of option names to values.
func (*OptionParser) On ¶
func (op *OptionParser) On(flags []string, desc string, callback func(string))
On registers an option with a description and callback. flags can be "-s", "--long", "--long VALUE", "-s VALUE", etc.
func (*OptionParser) OnHead ¶
func (op *OptionParser) OnHead(flags []string, desc string, callback func(string))
OnHead registers an option at the head of the list.
func (*OptionParser) OnTail ¶
func (op *OptionParser) OnTail(flags []string, desc string, callback func(string))
OnTail registers an option at the tail of the list.
func (*OptionParser) Order ¶
func (op *OptionParser) Order(args []string) []string
Order processes arguments in order mode (stops at first non-option).
func (*OptionParser) OrderBang ¶
func (op *OptionParser) OrderBang(args []string) []string
OrderBang is the destructive version of Order.
func (*OptionParser) Parse ¶
func (op *OptionParser) Parse(args []string) []string
Parse parses the given arguments and returns remaining non-option args.
func (*OptionParser) ParseBang ¶
func (op *OptionParser) ParseBang(args []string) []string
ParseBang parses os.Args[1:] in-place (destructive parse).
func (*OptionParser) Reject ¶
func (op *OptionParser) Reject(_ string)
Reject is a no-op compatibility stub.
func (*OptionParser) Separator ¶
func (op *OptionParser) Separator(text string)
Separator adds a separator line to the help output.
func (*OptionParser) SetBanner ¶
func (op *OptionParser) SetBanner(b string)
SetBanner sets the banner string.
func (*OptionParser) SetProgramName ¶
func (op *OptionParser) SetProgramName(name string)
SetProgramName sets the program name.
func (*OptionParser) SetVersion ¶
func (op *OptionParser) SetVersion(v string)
SetVersion sets the version string.
type PStore ¶
type PStore struct {
// contains filtered or unexported fields
}
PStore is a simple persistent key-value store backed by a file. Mirrors Ruby's PStore class using Go's encoding/gob.
func (*PStore) Abort ¶
func (ps *PStore) Abort()
Abort rolls back changes made in the current transaction. Mirrors PStore#abort.
func (*PStore) Commit ¶
func (ps *PStore) Commit()
Commit saves the current state. Mirrors PStore#commit.
func (*PStore) GetUltraSafe ¶
GetUltraSafe returns the ultra_safe flag.
func (*PStore) RootExists ¶
RootExists checks if a key exists. Mirrors PStore#root?.
func (*PStore) SetUltraSafe ¶
SetUltraSafe sets the ultra_safe flag.
func (*PStore) Transaction ¶
func (ps *PStore) Transaction(fn func())
Transaction starts a transaction, runs the given function, and commits. Mirrors PStore#transaction { ... }.
type Pathname ¶
type Pathname struct {
// contains filtered or unexported fields
}
Pathname wraps a file path string, mirroring Ruby's Pathname class.
func NewPathname ¶
NewPathname creates a new Pathname from a path string.
func (*Pathname) Ascend ¶
Ascend yields the path and each parent up to the root, returning them as a slice.
func (*Pathname) Atime ¶
Atime returns the access time of the file (falls back to mtime on platforms that don't expose it).
func (*Pathname) Birthtime ¶
Birthtime returns the creation time of the file (best effort, falls back to mtime).
func (*Pathname) Compare ¶
Compare compares the path strings lexicographically. Returns -1, 0, or 1.
func (*Pathname) Concat ¶
Concat joins the given string to the path (same semantics as Join for porting purposes).
func (*Pathname) Ctime ¶
Ctime returns the inode change time (falls back to mtime on platforms without direct support).
func (*Pathname) Descend ¶
Descend yields the root and each directory down to the full path, returning them as a slice.
func (*Pathname) EachEntry ¶
EachEntry returns directory entries as Pathnames (same as Entries but without . and ..).
func (*Pathname) EachFilename ¶
EachFilename returns each component of the path as a string slice.
func (*Pathname) Entries ¶
Entries returns the directory contents (including "." and "..") as Pathnames.
func (*Pathname) ExpandPath ¶
func (*Pathname) Fnmatch ¶
Fnmatch reports whether the path matches the given shell pattern using Ruby semantics: * matches any character sequence including path separators.
func (*Pathname) Ftype ¶
Ftype returns the file type string: "file", "directory", "link", "characterSpecial", "blockSpecial", "fifo", "socket", or "unknown".
func (*Pathname) IsAbsolute ¶
IsAbsolute returns true if the path is absolute.
func (*Pathname) IsBlockdev ¶
IsBlockdev returns true if the path is a block device.
func (*Pathname) IsDirectory ¶
func (*Pathname) IsExecutable ¶
IsExecutable returns true if the file has any execute permission bits set.
func (*Pathname) IsExecutableReal ¶
IsExecutableReal returns true if the real user has execute permission.
func (*Pathname) IsGrpowned ¶
IsGrpowned returns true if the file is group-owned by the current user's group.
func (*Pathname) IsMountpoint ¶
IsMountpoint checks if the path is a mount point. On most systems, we check if the device of the path differs from its parent.
func (*Pathname) IsReadable ¶
IsReadable returns true if the file has any read permission bits set.
func (*Pathname) IsReadableReal ¶
IsReadableReal returns true if the real user has read permission.
func (*Pathname) IsRelative ¶
IsRelative returns true if the path is relative.
func (*Pathname) IsWorldReadable ¶
IsWorldReadable returns true if the file is world-readable.
func (*Pathname) IsWorldWritable ¶
IsWorldWritable returns true if the file is world-writable.
func (*Pathname) IsWritable ¶
IsWritable returns true if the file has any write permission bits set.
func (*Pathname) IsWritableReal ¶
IsWritableReal returns true if the real user has write permission.
func (*Pathname) MakeSymlink ¶
MakeSymlink creates a symlink at p.path pointing to target.
func (*Pathname) MarshalText ¶
MarshalText makes Pathname print correctly with fmt.Println.
func (*Pathname) Mkpath ¶
func (p *Pathname) Mkpath()
Mkpath creates the directory and all parents (like mkdir -p).
func (*Pathname) Readlines ¶
Readlines returns the lines of the file as a slice of strings (with newlines).
func (*Pathname) Realdirpath ¶
Realdirpath resolves symlinks in the directory part; the final component need not exist (mirrors Ruby's Pathname#realdirpath).
func (*Pathname) RelativePathFrom ¶
RelativePathFrom returns a relative path from the given base directory.
func (*Pathname) Rmdir ¶
func (p *Pathname) Rmdir()
Rmdir removes the (empty) directory at the path.
func (*Pathname) SizeQ ¶
SizeQ returns the file size, or 0 if the file does not exist (Ruby's size?).
func (*Pathname) Sub ¶
Sub replaces the first occurrence of pattern with replacement in the path string.
type StringScanner ¶
type StringScanner struct {
// contains filtered or unexported fields
}
StringScanner implements Ruby's StringScanner class for sequential string parsing. It tracks a current position and provides anchored/unanchored regexp scanning.
func NewStringScanner ¶
func NewStringScanner(str string) *StringScanner
NewStringScanner creates a new StringScanner positioned at the start of str.
func (*StringScanner) BolP ¶
func (ss *StringScanner) BolP() bool
BolP returns true if the current position is at the beginning of a line.
func (*StringScanner) Captures ¶
func (ss *StringScanner) Captures() []string
Captures returns the capture groups from the last match as a slice of strings, excluding the full match at index 0. Returns nil if there was no match.
func (*StringScanner) Check ¶
func (ss *StringScanner) Check(pattern *regexp.Regexp) string
Check attempts to match pattern anchored at the current position without advancing. Returns matched string or "" on no match.
func (*StringScanner) CheckUntil ¶
func (ss *StringScanner) CheckUntil(pattern *regexp.Regexp) string
CheckUntil scans forward without advancing to find pattern. Returns the substring up through the match end, or "" on no match.
func (*StringScanner) Concat ¶
func (ss *StringScanner) Concat(str string) *StringScanner
Concat appends str to the scanner's string and returns the scanner.
func (*StringScanner) EOS ¶
func (ss *StringScanner) EOS() bool
EOS returns true if the scanner is at the end of the string.
func (*StringScanner) Exist ¶
func (ss *StringScanner) Exist(pattern *regexp.Regexp) int
Exist checks whether pattern matches anywhere in the remaining string. Returns the number of bytes from the current position to the end of the match, or -1 if there is no match. (Ruby returns nil on no match.)
func (*StringScanner) Getch ¶
func (ss *StringScanner) Getch() string
Getch returns the next character and advances the position by one. Returns "" if at end of string.
func (*StringScanner) Inspect ¶
func (ss *StringScanner) Inspect() string
Inspect returns a human-readable description of the scanner state.
func (*StringScanner) MatchSize ¶
func (ss *StringScanner) MatchSize(pattern *regexp.Regexp) int
MatchSize returns the length of the match if pattern matches at the current position (anchored), without advancing. Returns -1 on no match. Ruby: match? returns nil on no match; -1 is the Go sentinel.
func (*StringScanner) Matched ¶
func (ss *StringScanner) Matched() string
Matched returns the last matched string. Returns "" if no prior match.
func (*StringScanner) MatchedP ¶
func (ss *StringScanner) MatchedP() bool
MatchedP returns true if the last operation produced a match.
func (*StringScanner) MatchedSize ¶
func (ss *StringScanner) MatchedSize() int
MatchedSize returns the byte length of the last matched string, or -1 if there was no match. (Ruby returns nil on no match.)
func (*StringScanner) NamedCapture ¶
func (ss *StringScanner) NamedCapture(name string) string
NamedCapture returns the value of a single named capture group from the last match. Returns "" if the group does not exist or there was no match.
func (*StringScanner) NamedCaptures ¶
func (ss *StringScanner) NamedCaptures() map[string]string
NamedCaptures returns a map of named capture group names to their matched strings from the last match. Returns an empty map if no match or no named groups.
func (*StringScanner) Peek ¶
func (ss *StringScanner) Peek(n int) string
Peek returns the next n characters without advancing the position.
func (*StringScanner) Pos ¶
func (ss *StringScanner) Pos() int
Pos returns the current scanner position (byte offset).
func (*StringScanner) PostMatch ¶
func (ss *StringScanner) PostMatch() string
PostMatch returns the portion of the string after the last match.
func (*StringScanner) PreMatch ¶
func (ss *StringScanner) PreMatch() string
PreMatch returns the portion of the string before the last match.
func (*StringScanner) Reset ¶
func (ss *StringScanner) Reset() *StringScanner
Reset moves the position back to the beginning of the string and clears match state.
func (*StringScanner) Rest ¶
func (ss *StringScanner) Rest() string
Rest returns the substring from the current position to the end of the string.
func (*StringScanner) RestP ¶
func (ss *StringScanner) RestP() bool
RestP returns true if there are characters remaining (i.e. not at end of string).
func (*StringScanner) RestSize ¶
func (ss *StringScanner) RestSize() int
RestSize returns the number of characters remaining from the current position.
func (*StringScanner) Scan ¶
func (ss *StringScanner) Scan(pattern *regexp.Regexp) string
Scan attempts to match pattern anchored at the current position. On match: advances pos past the match and returns the matched string. On no match: returns "" and sets matched? to false.
func (*StringScanner) ScanUntil ¶
func (ss *StringScanner) ScanUntil(pattern *regexp.Regexp) string
ScanUntil scans forward from the current position until pattern matches. Returns the substring from the current position up through the end of the match, and advances pos. Returns "" on no match.
func (*StringScanner) SetPos ¶
func (ss *StringScanner) SetPos(n int)
SetPos sets the current scanner position (byte offset).
func (*StringScanner) SetStr ¶
func (ss *StringScanner) SetStr(s string)
SetStr replaces the string being scanned and resets position.
func (*StringScanner) Size ¶
func (ss *StringScanner) Size() int
Size returns the total number of captures in the last match (including the full match at index 0), or -1 if there was no match.
func (*StringScanner) Skip ¶
func (ss *StringScanner) Skip(pattern *regexp.Regexp) int
Skip attempts to match pattern anchored at the current position and advances past it. Returns the number of bytes skipped, or 0 on no match.
func (*StringScanner) SkipUntil ¶
func (ss *StringScanner) SkipUntil(pattern *regexp.Regexp) int
SkipUntil scans forward until pattern matches and advances pos to end of match. Returns the number of bytes advanced, or 0 on no match.
func (*StringScanner) Str ¶
func (ss *StringScanner) Str() string
Str returns the string being scanned.
func (*StringScanner) Terminate ¶
func (ss *StringScanner) Terminate() *StringScanner
Terminate moves the position to the end of the string and clears match state.
func (*StringScanner) Unscan ¶
func (ss *StringScanner) Unscan() *StringScanner
Unscan rewinds pos to the position before the most recent match.
type Tempfile ¶
type Tempfile struct {
// contains filtered or unexported fields
}
Tempfile is a shim for Ruby's Tempfile class. It wraps *os.File and tracks the path so it remains accessible after Close.
func NewTempfile ¶
NewTempfile creates a new temporary file with the given prefix. Mirrors Ruby's Tempfile.new(prefix).
func TempfileCreate ¶
TempfileCreate creates a temp file, yields it to a function, then cleans up. Mirrors Ruby's Tempfile.create(prefix).
func TempfileOpen ¶
TempfileOpen creates a temp file (like new) for use with Tempfile.open. Mirrors Ruby's Tempfile.open(prefix).
func (*Tempfile) Close ¶
func (t *Tempfile) Close()
Close closes the file without deleting it. Mirrors Ruby's Tempfile#close.
func (*Tempfile) CloseAndUnlink ¶
func (t *Tempfile) CloseAndUnlink()
CloseAndUnlink closes and deletes the file. Mirrors Ruby's Tempfile#close!.
func (*Tempfile) Flush ¶
func (t *Tempfile) Flush()
Flush syncs buffered data to the underlying storage. Mirrors Ruby's Tempfile#flush.
func (*Tempfile) Open ¶
func (t *Tempfile) Open()
Open reopens the underlying temp file for reading/writing. Mirrors Ruby's Tempfile#open.
func (*Tempfile) Path ¶
Path returns the absolute path to the temporary file. Mirrors Ruby's Tempfile#path.
func (*Tempfile) Read ¶
Read seeks to the start of the file and returns its full contents. Mirrors Ruby's Tempfile#read.
func (*Tempfile) Rewind ¶
Rewind seeks to the beginning of the file and returns 0. Mirrors Ruby's Tempfile#rewind.
func (*Tempfile) Size ¶
Size returns the current size of the file in bytes. Mirrors Ruby's Tempfile#size / Tempfile#length.
func (*Tempfile) Truncate ¶
Truncate truncates the file to at most size bytes. Mirrors Ruby's Tempfile#truncate(size).
type TimeoutError ¶
type TimeoutError struct {
Message string
}
TimeoutError is raised when a timeout expires.
func (*TimeoutError) Error ¶
func (e *TimeoutError) Error() string
type URI ¶
type URI struct {
// contains filtered or unexported fields
}
URI wraps *url.URL to provide Ruby-compatible accessor methods.
func (*URI) DecodedPassword ¶
DecodedPassword returns the percent-decoded password component.
func (*URI) DecodedUser ¶
DecodedUser returns the percent-decoded username component.
func (*URI) DefaultPort ¶
DefaultPort returns the default port for the URI's scheme (http=80, https=443, etc.). Returns 0 for unknown schemes.
func (*URI) Inspect ¶
Inspect returns a Ruby-style inspect string for a URI. Matches Ruby's format: "#<URI::HTTP ...>" or "#<URI::Generic ...>" for relative URIs.
func (*URI) IsHierarchical ¶
IsHierarchical returns true if the URI is hierarchical (has an authority or path).
func (*URI) MarshalText ¶
MarshalText makes URI print correctly with fmt.Println.
func (*URI) Merge ¶
Merge resolves other (a URI string) against u, returning a new URI. This mirrors Ruby's URI#merge and URI#+ methods.
func (*URI) RequestURI ¶
RequestURI returns the path and query string (e.g. "/path?q=1").
func (*URI) Select ¶
Select returns the components of the URI that the given selectors match. This is a simplified version: returns all non-empty components.
func (*URI) SetFragment ¶
SetFragment sets the fragment and returns the new value (Ruby: fragment=).
func (*URI) SetHostname ¶
SetHostname sets just the hostname (preserving port) and returns it.
func (*URI) SetPassword ¶
SetPassword sets the password component of the URI and returns it.
func (*URI) SetUserinfo ¶
SetUserinfo sets the userinfo component ("user:password") and returns it.
type WeakRef ¶
type WeakRef struct {
// contains filtered or unexported fields
}
WeakRef wraps an arbitrary value. In Go there are no weak references, so this is effectively a strong reference that satisfies the Ruby WeakRef API.
func NewWeakRef ¶
NewWeakRef creates a WeakRef wrapping the given object.
Source Files
¶
- abbrev.go
- base64.go
- benchmark.go
- date.go
- digest.go
- digest_instance.go
- dir.go
- env.go
- erb.go
- etc.go
- fileutils.go
- find.go
- getoptlong.go
- ipaddr.go
- json.go
- kernel.go
- logger.go
- mutex_m.go
- observer.go
- open3.go
- openuri.go
- optparse.go
- ostruct.go
- pathname.go
- pp.go
- process.go
- pstore.go
- random.go
- regexp.go
- securerandom.go
- shellwords.go
- singleton.go
- stringio.go
- strscan.go
- syslog_unix.go
- tempfile.go
- timeout.go
- tsort.go
- uri.go
- weakref.go
- yaml.go
- zlib.go