mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
chore: remove unnecessary redeclarations in for loops (#18440)
This commit is contained in:
@ -107,7 +107,6 @@ func TestExtractUserRoles(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, c := range testCases {
|
||||
c := c
|
||||
t.Run(c.Name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -91,7 +91,6 @@ func TestWorkspaceAppCors(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -57,7 +57,6 @@ func TestCSRFExemptList(t *testing.T) {
|
||||
csrfmw := mw(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})).(*nosurf.CSRFHandler)
|
||||
|
||||
for _, c := range cases {
|
||||
c := c
|
||||
t.Run(c.Name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -77,7 +77,6 @@ func TestHSTS(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.Name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -247,7 +247,6 @@ func TestRequestLogger_RouteParamsLogging(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -108,7 +108,6 @@ func Test_RoutePatterns(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
c := c
|
||||
t.Run(c.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -200,7 +200,6 @@ func TestExtractAddress(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
t.Run(test.Name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -235,9 +234,6 @@ func TestTrustedOrigins(t *testing.T) {
|
||||
// ipv6: trust an IPv4 network
|
||||
for _, trusted := range []string{"none", "ipv4", "ipv6"} {
|
||||
for _, header := range []string{"Cf-Connecting-Ip", "True-Client-Ip", "X-Real-Ip", "X-Forwarded-For"} {
|
||||
trusted := trusted
|
||||
header := header
|
||||
proto := proto
|
||||
name := fmt.Sprintf("%s-%s-%s", trusted, proto, strings.ToLower(header))
|
||||
|
||||
t.Run(name, func(t *testing.T) {
|
||||
@ -311,7 +307,6 @@ func TestCorruptedHeaders(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
for _, header := range []string{"Cf-Connecting-Ip", "True-Client-Ip", "X-Real-Ip", "X-Forwarded-For"} {
|
||||
header := header
|
||||
name := strings.ToLower(header)
|
||||
|
||||
t.Run(name, func(t *testing.T) {
|
||||
@ -364,9 +359,6 @@ func TestAddressFamilies(t *testing.T) {
|
||||
for _, clientFamily := range []string{"ipv4", "ipv6"} {
|
||||
for _, proxyFamily := range []string{"ipv4", "ipv6"} {
|
||||
for _, header := range []string{"Cf-Connecting-Ip", "True-Client-Ip", "X-Real-Ip", "X-Forwarded-For"} {
|
||||
clientFamily := clientFamily
|
||||
proxyFamily := proxyFamily
|
||||
header := header
|
||||
name := fmt.Sprintf("%s-%s-%s", strings.ToLower(header), clientFamily, proxyFamily)
|
||||
|
||||
t.Run(name, func(t *testing.T) {
|
||||
@ -466,7 +458,6 @@ func TestFilterUntrusted(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
t.Run(test.Name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -612,7 +603,6 @@ func TestApplicationProxy(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
t.Run(test.Name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -52,8 +52,6 @@ func TestRecover(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
c := c
|
||||
|
||||
t.Run(c.Name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -316,7 +316,6 @@ func TestWorkspaceAgentByNameParam(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, c := range testCases {
|
||||
c := c
|
||||
t.Run(c.Name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
db, r := setupWorkspaceWithAgents(t, setupConfig{
|
||||
|
Reference in New Issue
Block a user