# Extension points — gotestyourself/gotestsum

> Canonical page: https://codevetter.com/unpack/gotestsum/extension-points

# Extension points — gotestyourself/gotestsum

Scanned commit 3cf14356a16c7931cfeacd7dfee585527618df3d (2026-04-14). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

Extension mechanisms are explicit Go interfaces, factories, and command switches. The reusable event parser allows callers to provide readers, callbacks, cancellation, and existing execution state. Reporting and automation extensions fit through formatters, JUnit configuration, and post-run executables. New commands require direct router and help integration.
- Add a tool command through main.toolRun's dispatch switch and usage text, following the existing Run(name, args) interface used by slowest and matrix. — [main.go#L53-L77](https://github.com/gotestyourself/gotestsum/blob/3cf14356a16c7931cfeacd7dfee585527618df3d/main.go#L53-L77) [cmd/tool/slowest/slowest.go#L15-L25](https://github.com/gotestyourself/gotestsum/blob/3cf14356a16c7931cfeacd7dfee585527618df3d/cmd/tool/slowest/slowest.go#L15-L25) [cmd/tool/matrix/matrix.go#L20-L31](https://github.com/gotestyourself/gotestsum/blob/3cf14356a16c7931cfeacd7dfee585527618df3d/cmd/tool/matrix/matrix.go#L20-L31)
- New terminal formats plug into EventFormatter.Format and NewEventFormatter's explicit factory switch; unknown names return nil and become a command error. — [testjson/format.go#L404-L454](https://github.com/gotestyourself/gotestsum/blob/3cf14356a16c7931cfeacd7dfee585527618df3d/testjson/format.go#L404-L454) [cmd/handler.go#L100-L104](https://github.com/gotestyourself/gotestsum/blob/3cf14356a16c7931cfeacd7dfee585527618df3d/cmd/handler.go#L100-L104)
- EventHandler.Event and Err support custom consumers, with an Event error stopping scanning; ScanConfig accepts custom readers, Stop callbacks, RunID, and an existing Execution. — [testjson/execution.go#L729-L758](https://github.com/gotestyourself/gotestsum/blob/3cf14356a16c7931cfeacd7dfee585527618df3d/testjson/execution.go#L729-L758) [testjson/execution.go#L802-L805](https://github.com/gotestyourself/gotestsum/blob/3cf14356a16c7931cfeacd7dfee585527618df3d/testjson/execution.go#L802-L805)
- A caller can omit Handler and Stderr for standalone log parsing; ScanTestOutput supplies a no-op handler and empty stderr reader. — [testjson/doc.go#L7-L20](https://github.com/gotestyourself/gotestsum/blob/3cf14356a16c7931cfeacd7dfee585527618df3d/testjson/doc.go#L7-L20) [testjson/execution.go#L765-L776](https://github.com/gotestyourself/gotestsum/blob/3cf14356a16c7931cfeacd7dfee585527618df3d/testjson/execution.go#L765-L776)
- JUnit Config accepts FormatFunc callbacks for suite names and testcase classnames, with identity defaults; CLI full/relative/short options adapt these callbacks. — [internal/junitxml/report.go#L80-L93](https://github.com/gotestyourself/gotestsum/blob/3cf14356a16c7931cfeacd7dfee585527618df3d/internal/junitxml/report.go#L80-L93) [internal/junitxml/report.go#L153-L163](https://github.com/gotestyourself/gotestsum/blob/3cf14356a16c7931cfeacd7dfee585527618df3d/internal/junitxml/report.go#L153-L163) [cmd/flags.go#L55-L72](https://github.com/gotestyourself/gotestsum/blob/3cf14356a16c7931cfeacd7dfee585527618df3d/cmd/flags.go#L55-L72)
- --post-run-command integrates external automation through argument parsing, output writers, report paths, elapsed time, and TESTS_* counters; notification examples consume those counters. — [cmd/flags.go#L90-L114](https://github.com/gotestyourself/gotestsum/blob/3cf14356a16c7931cfeacd7dfee585527618df3d/cmd/flags.go#L90-L114) [cmd/handler.go#L160-L181](https://github.com/gotestyourself/gotestsum/blob/3cf14356a16c7931cfeacd7dfee585527618df3d/cmd/handler.go#L160-L181) [contrib/notify/notify_linux.go#L11-L15](https://github.com/gotestyourself/gotestsum/blob/3cf14356a16c7931cfeacd7dfee585527618df3d/contrib/notify/notify_linux.go#L11-L15) [contrib/notify/notify_linux.go#L50-L56](https://github.com/gotestyourself/gotestsum/blob/3cf14356a16c7931cfeacd7dfee585527618df3d/contrib/notify/notify_linux.go#L50-L56)
- filewatcher.Watch accepts a run(Event) callback, separating filesystem/keyboard event detection from command execution; Event carries package path, appended arguments, and debug mode. — [internal/filewatcher/watch.go#L21-L41](https://github.com/gotestyourself/gotestsum/blob/3cf14356a16c7931cfeacd7dfee585527618df3d/internal/filewatcher/watch.go#L21-L41) [cmd/watch.go#L14-L19](https://github.com/gotestyourself/gotestsum/blob/3cf14356a16c7931cfeacd7dfee585527618df3d/cmd/watch.go#L14-L19)
- ByElapsed accepts a timing-reduction function, slowest supports custom parsed Go statements, and rerunFailsFilter selects either root cases or FilterFailedUnique; these are concrete policy seams for aggregation, rewriting, and retries. — [internal/aggregate/slowest.go#L42-L63](https://github.com/gotestyourself/gotestsum/blob/3cf14356a16c7931cfeacd7dfee585527618df3d/internal/aggregate/slowest.go#L42-L63) [cmd/tool/slowest/ast.go#L77-L93](https://github.com/gotestyourself/gotestsum/blob/3cf14356a16c7931cfeacd7dfee585527618df3d/cmd/tool/slowest/ast.go#L77-L93) [cmd/rerunfails.go#L37-L51](https://github.com/gotestyourself/gotestsum/blob/3cf14356a16c7931cfeacd7dfee585527618df3d/cmd/rerunfails.go#L37-L51)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
