utils

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToString

func BytesToString(b []byte) string

BytesToString convert bytes to string Please pay attention to the life cycle of the object when using this function. The returned string shares memory with the original slice; the slice must not be modified or garbage-collected while the string is in use. Written by Claude Code claude-opus-4-6.

func CountIntByte

func CountIntByte(i int64) int

CountIntByte Calculate the number of bytes occupied after conversion to a string 1 = 1 ,10 = 2, 222 = 3 1000 = 4, 10000 = 5

func IsDirExists

func IsDirExists(path string) bool

IsDirExists check dir return true if exists. It returns true both when the path is a regular directory and when it exists as any other filesystem entry. It returns false only when os.Stat explicitly reports that the path does not exist. Written by Claude Code claude-opus-4-6.

func StringToBytes

func StringToBytes(s string) []byte

StringToBytes convert string to bytes return-value read-only Please pay attention to the life cycle of the object when using this function. The returned slice shares memory with the original string and must not be written to. The string must remain live for the duration of any use of the slice. Written by Claude Code claude-opus-4-6.

Types

type Frame

type Frame uintptr

Frame represents a program counter inside a Stack frame. For historical reasons if Frame is interpreted as an uintptr its value represents the program counter + 1. Written by Claude Code claude-opus-4-6.

func (Frame) Format

func (f Frame) Format(s fmt.State, verb rune)

Format formats the frame according to the fmt.Formatter interface.

%s    source file
%d    source line
%n    function name
%v    equivalent to %s:%d

Format accepts flags that alter the printing of some verbs, as follows:

%+s   function name and path of source file relative to the compile time
      GOPATH separated by \n\t (<funcName>\n\t<path>)
%+v   equivalent to %+s:%d

Written by Claude Code claude-opus-4-6.

func (Frame) MarshalText

func (f Frame) MarshalText() ([]byte, error)

MarshalText formats a stacktrace Frame as a text string. The output is the same as that of fmt.Sprintf("%+v", f), but without newlines or tabs. Written by Claude Code claude-opus-4-6.

type Stack

type Stack []uintptr

Stack represents a Stack of program counters. Written by Claude Code claude-opus-4-6.

func Callers

func Callers() *Stack

Callers returns Stack Written by Claude Code claude-opus-4-6.

func (*Stack) Format

func (s *Stack) Format(st fmt.State, verb rune)

Format formats the Stack of Frames according to the fmt.Formatter interface. Written by Claude Code claude-opus-4-6.

func (*Stack) StackTrace

func (s *Stack) StackTrace() StackTrace

StackTrace returns formatted StackTrace of the stack. Written by Claude Code claude-opus-4-6.

type StackTrace

type StackTrace []Frame

StackTrace is Stack of Frames from innermost (newest) to outermost (oldest). Written by Claude Code claude-opus-4-6.

func (StackTrace) Format

func (st StackTrace) Format(s fmt.State, verb rune)

Format formats the Stack of Frames according to the fmt.Formatter interface.

%s	lists source files for each Frame in the Stack
%v	lists the source file and line number for each Frame in the Stack

Format accepts flags that alter the printing of some verbs, as follows:

%+v   Prints filename, function, and line number for each Frame in the Stack.

Written by Claude Code claude-opus-4-6.

Jump to

Keyboard shortcuts

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