fix code format

This commit is contained in:
田欧 2019-02-20 13:38:41 +08:00 committed by GitHub
parent 5e11eee96e
commit bc9d0e6939
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -347,26 +347,26 @@ func TestBindUriError(t *testing.T) {
} }
func TestRaceContextCopy(t *testing.T) { func TestRaceContextCopy(t *testing.T) {
DefaultWriter = os.Stdout DefaultWriter = os.Stdout
router := Default() router := Default()
router.GET("/test/copy/race", func(c *Context) { router.GET("/test/copy/race", func(c *Context) {
c.Set("1", 0) c.Set("1", 0)
c.Set("2", 0) c.Set("2", 0)
// Sending a copy of the Context to two separate routines // Sending a copy of the Context to two separate routines
go readWriteKeys(c.Copy()) go readWriteKeys(c.Copy())
go readWriteKeys(c.Copy()) go readWriteKeys(c.Copy())
c.String(http.StatusOK, "run OK, no panics") c.String(http.StatusOK, "run OK, no panics")
}) })
w := performRequest(router, "GET", "/test/copy/race") w := performRequest(router, "GET", "/test/copy/race")
assert.Equal(t, "run OK, no panics", w.Body.String()) assert.Equal(t, "run OK, no panics", w.Body.String())
} }
func readWriteKeys(c *Context) { func readWriteKeys(c *Context) {
for { for {
c.Set("1", rand.Int()) c.Set("1", rand.Int())
c.Set("2", c.Value("1")) c.Set("2", c.Value("1"))
} }
} }
func githubConfigRouter(router *Engine) { func githubConfigRouter(router *Engine) {