captureOutput() — gin Function Reference
Architecture documentation for the captureOutput() function in debug_test.go from the gin codebase.
Entity Profile
Dependency Diagram
graph TD 00345091_92ac_a265_c869_edad36a41a3b["captureOutput()"] 93aa143e_ba29_95e3_6171_a922a9c84ca0["debug_test.go"] 00345091_92ac_a265_c869_edad36a41a3b -->|defined in| 93aa143e_ba29_95e3_6171_a922a9c84ca0 7db186ae_ce0d_c1d7_4224_891eb837bcb4["TestDebugPrint()"] 7db186ae_ce0d_c1d7_4224_891eb837bcb4 -->|calls| 00345091_92ac_a265_c869_edad36a41a3b 57eedfe7_0eeb_418f_225d_a789f164fd87["TestDebugPrintFunc()"] 57eedfe7_0eeb_418f_225d_a789f164fd87 -->|calls| 00345091_92ac_a265_c869_edad36a41a3b 2fa6b311_9bc1_6b03_1fea_dab4c59689d6["TestDebugPrintError()"] 2fa6b311_9bc1_6b03_1fea_dab4c59689d6 -->|calls| 00345091_92ac_a265_c869_edad36a41a3b 37f99941_5f32_fba2_6f1b_69ed5bb28497["TestDebugPrintRoutes()"] 37f99941_5f32_fba2_6f1b_69ed5bb28497 -->|calls| 00345091_92ac_a265_c869_edad36a41a3b 63b0d5d4_4938_32fd_d22b_db1e49e8338a["TestDebugPrintRouteFunc()"] 63b0d5d4_4938_32fd_d22b_db1e49e8338a -->|calls| 00345091_92ac_a265_c869_edad36a41a3b 9b1e0db2_80b7_7085_4dd1_b1f42cadacca["TestDebugPrintLoadTemplate()"] 9b1e0db2_80b7_7085_4dd1_b1f42cadacca -->|calls| 00345091_92ac_a265_c869_edad36a41a3b 1702e5f1_47b4_937c_0c9d_66f5c3992d7c["TestDebugPrintWARNINGSetHTMLTemplate()"] 1702e5f1_47b4_937c_0c9d_66f5c3992d7c -->|calls| 00345091_92ac_a265_c869_edad36a41a3b de15151c_7701_3497_8c79_142c55c949a3["TestDebugPrintWARNINGDefault()"] de15151c_7701_3497_8c79_142c55c949a3 -->|calls| 00345091_92ac_a265_c869_edad36a41a3b b70aa520_5151_495f_9731_0dce2b6c1af7["TestDebugPrintWARNINGDefaultWithUnsupportedVersion()"] b70aa520_5151_495f_9731_0dce2b6c1af7 -->|calls| 00345091_92ac_a265_c869_edad36a41a3b 13d495d7_8c64_938a_aed4_de8ef413328f["TestDebugPrintWARNINGNew()"] 13d495d7_8c64_938a_aed4_de8ef413328f -->|calls| 00345091_92ac_a265_c869_edad36a41a3b style 00345091_92ac_a265_c869_edad36a41a3b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
debug_test.go lines 136–165
func captureOutput(t *testing.T, f func()) string {
reader, writer, err := os.Pipe()
if err != nil {
panic(err)
}
defaultWriter := DefaultWriter
defaultErrorWriter := DefaultErrorWriter
defer func() {
DefaultWriter = defaultWriter
DefaultErrorWriter = defaultErrorWriter
log.SetOutput(os.Stderr)
}()
DefaultWriter = writer
DefaultErrorWriter = writer
log.SetOutput(writer)
out := make(chan string)
wg := new(sync.WaitGroup)
wg.Add(1)
go func() {
var buf strings.Builder
wg.Done()
_, err := io.Copy(&buf, reader)
assert.NoError(t, err)
out <- buf.String()
}()
wg.Wait()
f()
writer.Close()
return <-out
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does captureOutput() do?
captureOutput() is a function in the gin codebase, defined in debug_test.go.
Where is captureOutput() defined?
captureOutput() is defined in debug_test.go at line 136.
What calls captureOutput()?
captureOutput() is called by 10 function(s): TestDebugPrint, TestDebugPrintError, TestDebugPrintFunc, TestDebugPrintLoadTemplate, TestDebugPrintRouteFunc, TestDebugPrintRoutes, TestDebugPrintWARNINGDefault, TestDebugPrintWARNINGDefaultWithUnsupportedVersion, and 2 more.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free