Skip to content

Commit 567a68a

Browse files
authored
Remove DataRaceCheck (#29258)
Since #26254, it started using `{{ctx.Locale.Tr ...}}` Now the `ctx` seems stable enough, so the check could be removed.
1 parent 740c6a2 commit 567a68a

File tree

3 files changed

+0
-16
lines changed

3 files changed

+0
-16
lines changed

modules/context/context_template.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ package context
55

66
import (
77
"context"
8-
"errors"
98
"time"
10-
11-
"code.gitea.io/gitea/modules/log"
129
)
1310

1411
var _ context.Context = TemplateContext(nil)
@@ -36,14 +33,3 @@ func (c TemplateContext) Err() error {
3633
func (c TemplateContext) Value(key any) any {
3734
return c.parentContext().Value(key)
3835
}
39-
40-
// DataRaceCheck checks whether the template context function "ctx()" returns the consistent context
41-
// as the current template's rendering context (request context), to help to find data race issues as early as possible.
42-
// When the code is proven to be correct and stable, this function should be removed.
43-
func (c TemplateContext) DataRaceCheck(dataCtx context.Context) (string, error) {
44-
if c.parentContext() != dataCtx {
45-
log.Error("TemplateContext.DataRaceCheck: parent context mismatch\n%s", log.Stack(2))
46-
return "", errors.New("parent context mismatch")
47-
}
48-
return "", nil
49-
}

templates/base/footer.tmpl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@
1616
<script src="{{AssetUrlPrefix}}/js/index.js?v={{AssetVersion}}" onerror="alert('Failed to load asset files from ' + this.src + '. Please make sure the asset files can be accessed.')"></script>
1717

1818
{{template "custom/footer" .}}
19-
{{ctx.DataRaceCheck $.Context}}
2019
</body>
2120
</html>

templates/base/head.tmpl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
{{template "custom/header" .}}
3131
</head>
3232
<body hx-headers='{"x-csrf-token": "{{.CsrfToken}}"}' hx-swap="outerHTML" hx-ext="morph" hx-push-url="false">
33-
{{ctx.DataRaceCheck $.Context}}
3433
{{template "custom/body_outer_pre" .}}
3534

3635
<div class="full height">

0 commit comments

Comments
 (0)