Documentation
¶
Index ¶
- Variables
- func AnalyzeTimeConsumed() func()
- func AssertEqual(t *testing.T, actual any, expected any)
- func AssertNot(t *testing.T, actual any, expected any)
- func CaptureStdout(fn func()) string
- func ErrorMsg(format string, a ...any)
- func Fail(t *testing.T, expected any, actual any)
- func ShouldIgnoreFile(cutRootDirPath string) bool
- func StartCPUProfile() func()
- func StartMemoryProfile() func()
- func StartTrace() func()
- func TimeIt(fn func(), task string)
- func WalkDir(root string, fn fs.WalkDirFunc) error
- func WithTimeoutCtxMilliSeconds(milliSeconds int) (context.Context, context.CancelFunc)
- func WithTimeoutCtxSeconds(seconds int) (context.Context, context.CancelFunc)
- type Set
Constants ¶
This section is empty.
Variables ¶
var ( VCSDirs *Set GitIgnore *ignore.GitIgnore CurrentRootDir string )
Functions ¶
func AnalyzeTimeConsumed ¶ added in v0.1.5
func AnalyzeTimeConsumed() func()
AnalyzeTimeConsumed is a function that returns a function that can be used to analyze the time consumed. Usage: defer AnalyzeTimeConsumed()()
func CaptureStdout ¶ added in v0.1.5
func CaptureStdout(fn func()) string
CaptureStdout captures the output of a function that writes to stdout and returns the output content as a string
func ShouldIgnoreFile ¶ added in v0.1.7
func StartCPUProfile ¶
func StartCPUProfile() func()
You can view the cpu profile file with `go tool pprof codetalks-cpu.prof` or visualize it on website like https://www.speedscope.app/
func StartMemoryProfile ¶
func StartMemoryProfile() func()
You can view the memory profile file with `go tool pprof codetalks-mem.prof` or visualize it on website like https://www.speedscope.app/
func StartTrace ¶
func StartTrace() func()
You can view the trace file with `go tool trace codetalks-trace.prof`
func WalkDir ¶ added in v0.1.7
func WalkDir(root string, fn fs.WalkDirFunc) error
WalkDir walks the file tree rooted at root, calling fn for each file or directory in the tree, including root.
All errors that arise visiting files and directories are filtered by fn: see the fs.WalkDirFunc documentation for details.
The files are walked in lexical order, which makes the output deterministic but requires WalkDir to read an entire directory into memory before proceeding to walk that directory.
WalkDir does not follow symbolic links.
WalkDir calls fn with paths that use the separator character appropriate for the operating system. This is unlike io/fs.WalkDir, which always uses slash separated paths.
func WithTimeoutCtxMilliSeconds ¶ added in v0.1.6
func WithTimeoutCtxMilliSeconds(milliSeconds int) (context.Context, context.CancelFunc)
func WithTimeoutCtxSeconds ¶ added in v0.1.6
func WithTimeoutCtxSeconds(seconds int) (context.Context, context.CancelFunc)
Types ¶
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Define a set as a map with keys of type string and values of type void