Home / Function/ TestRaceContextCopy() — gin Function Reference

TestRaceContextCopy() — gin Function Reference

Architecture documentation for the TestRaceContextCopy() function in githubapi_test.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  cbe681bc_3713_ac71_7faa_b4b24885cffe["TestRaceContextCopy()"]
  11845faa_1fc2_6a42_25f3_85f410f83d2e["readWriteKeys()"]
  cbe681bc_3713_ac71_7faa_b4b24885cffe -->|calls| 11845faa_1fc2_6a42_25f3_85f410f83d2e
  style cbe681bc_3713_ac71_7faa_b4b24885cffe fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

githubapi_test.go lines 351–365

func TestRaceContextCopy(t *testing.T) {
	DefaultWriter = os.Stdout
	router := Default()
	router.GET("/test/copy/race", func(c *Context) {
		c.Set("1", 0)
		c.Set("2", 0)

		// Sending a copy of the Context to two separate routines
		go readWriteKeys(c.Copy())
		go readWriteKeys(c.Copy())
		c.String(http.StatusOK, "run OK, no panics")
	})
	w := PerformRequest(router, http.MethodGet, "/test/copy/race")
	assert.Equal(t, "run OK, no panics", w.Body.String())
}

Domain

Subdomains

Frequently Asked Questions

What does TestRaceContextCopy() do?
TestRaceContextCopy() is a function in the gin codebase.
What does TestRaceContextCopy() call?
TestRaceContextCopy() calls 1 function(s): readWriteKeys.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free