func auth(c *wine.Context) { sid := c.Get("session_id") fmt.Println(sid) //auth sid //... authorized := false if authorized { //call the next handler c.Next() } else { //abort the handling process, send an error response resp := map[string]interface{}{"msg": "authorization failed"} c.JSON(resp) } }