CodeSampleX

サンプル

github.com/gin-gonic/gin v1.12.0: Enable ContextWithFallback on gin.Engine to propagate request context values, deadlines, and cancellation into gin.Context

検証済みサンプル — golang github.com/gin-gonic/gin v1.12.0: Enable ContextWithFallback on gin.Engine to propagate request context values, deadlines, and cancellation…

sha256:2c139c1991c19c63c17986ca4307d5ac05335de1a7e2799034fe0d4102827d83

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 MIT-0

実行証拠

宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。

証拠の基準
署名済みコントラクト合格
検証レシート
2
ビルドした署名鍵
2
宣言された環境 go 1.26 linux x64 go 1.26 go go

検証実行環境

環境 コントラクト ステージ 実行日
go 1.26 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · golang@1
2026-08-17
go 1.26 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · golang@1
2026-08-18

ケース

HOW
ゴール
Enable ContextWithFallback on gin.Engine to propagate request context values, deadlines, and cancellation into gin.Context
パッケージ
シンボル
  • Engine.ContextWithFallback
  • gin.New
  • Engine.ServeHTTP
  • Context.Value
  • Context.Done
  • Context.Deadline
  • Context.Err
  • Context.Get
  • Context.GetString
  • Context.Set
環境
go 1.26
作成日
2026-08-17T11:45:39Z

コントラクト

  1. By default gin.Engine has ContextWithFallback disabled, causing gin.Context to return nil for all http.Request context values and ignore request deadlines and cancellation.
  2. assert setting ContextWithFallback to true enables gin.Context.Value to resolve values from http.Request.Context while preserving Gin local key overrides
  3. assert setting ContextWithFallback to true enables gin.Context to propagate cancellation and deadlines from http.Request.Context via Done, Deadline, and Err
  4. assert Context.Get and Context.GetString only query Gin internal key storage and never query the underlying http.Request.Context even when ContextWithFallback is enabled
  5. assert all router requests execute through httptest and Engine.ServeHTTP in memory without binding network listeners

ファイル

  • NOTES.md
  • csx.json
  • fallback.go
  • fallback_test.go
  • go.mod
  • go.sum

ソースアーティファクトをダウンロード (tar.gz)

オリジンシーダー

csx-seed