mirror of
https://github.com/distribution/distribution.git
synced 2025-12-24 08:24:15 +00:00
refactor: remove redundant variable declarations in for loops (#4741)
This commit is contained in:
@@ -104,7 +104,6 @@ func TestContentEncoding(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
t.Run(tc.encodingHeader, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
content := make([]byte, 128)
|
||||
|
||||
@@ -41,7 +41,6 @@ func TestWithTrace(t *testing.T) {
|
||||
expected: f.Name(),
|
||||
})
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
t.Run(tc.key, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
v := ctx.Value(tc.key)
|
||||
@@ -74,7 +73,6 @@ func TestWithTrace(t *testing.T) {
|
||||
expected: parentID,
|
||||
})
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
t.Run(tc.key, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
v := ctx.Value(tc.key)
|
||||
|
||||
@@ -40,7 +40,6 @@ func TestErrorCodes(t *testing.T) {
|
||||
}
|
||||
|
||||
for ec := range errorCodeToDescriptors {
|
||||
ec := ec
|
||||
t.Run(ec.String(), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
desc := errorCodeToDescriptors[ec]
|
||||
|
||||
@@ -254,7 +254,6 @@ func checkTestRouter(t *testing.T, tests []routeTestCase, prefix string, deeplyE
|
||||
server := httptest.NewServer(router)
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
requestURI := strings.TrimSuffix(prefix, "/") + tc.RequestURI
|
||||
t.Run("("+tc.RouteName+")"+requestURI, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -27,7 +27,6 @@ func TestAudienceList_Unmarshal(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
t.Run("", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
var actual AudienceList
|
||||
|
||||
@@ -491,7 +491,6 @@ func (imh *manifestHandler) DeleteManifest(w http.ResponseWriter, r *http.Reques
|
||||
g := errgroup.Group{}
|
||||
g.SetLimit(storage.DefaultConcurrencyLimit)
|
||||
for _, tag := range referencedTags {
|
||||
tag := tag
|
||||
|
||||
g.Go(func() error {
|
||||
if err := tagService.Untag(imh, tag); err != nil {
|
||||
|
||||
@@ -63,7 +63,6 @@ func TestErrors(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
if got := tc.errs.Error(); got != tc.exp {
|
||||
|
||||
@@ -311,7 +311,6 @@ func TestEligibleForS3(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
t.Run(fmt.Sprintf("Client IP = %v", tc.RemoteAddr), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
req := &http.Request{RemoteAddr: tc.RemoteAddr}
|
||||
@@ -340,7 +339,6 @@ func TestEligibleForS3WithAWSIPNotInitialized(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
t.Run(fmt.Sprintf("Client IP = %v", tc.RemoteAddr), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
req := &http.Request{RemoteAddr: tc.RemoteAddr}
|
||||
|
||||
Reference in New Issue
Block a user