mirror of
https://github.com/yusing/godoxy.git
synced 2026-02-25 20:04:55 +01:00
1.1 KiB
1.1 KiB
AGENTS.md
Development Commands
- Build: You should not run build command.
- Test:
go test -ldflags="-checklinkname=0" ...
Documentation
Update package level README.md if exists after making significant changes.
Go Guidelines
- Use builtin
minandmaxfunctions instead of creating custom ones - Prefer
for i := range 10overfor i := 0; i < 10; i++ - Beware of variable shadowing when making edits
- Use
internal/task/task.gofor lifetime management:task.RootTask()for background operationsparent.Subtask()for nested tasksOnFinished()andOnCancel()callbacks for cleanup
- Use
gperr "goutils/errs"to build pretty nested errors:gperr.Multiline()for multiple operation attemptsgperr.NewBuilder()to collect errorsgperr.NewGroup() + group.Go()to collect errors of multiple concurrent operationsgperr.PrependSubject()to prepend subject to errors
- Use
github.com/puzpuzpuz/xsync/v4for lock-free thread safe maps - Use
goutils/synkto retrieve and put byte buffer
Testing
- Run scoped tests instead of
./... - Use
testify, no manual assertions.