Kaynağa Gözat

Use explicit else for array/map selection

This is a simple if/else logic so I agree an explicit else clause
is appropriate.
Raul Silvera 8 yıl önce
ebeveyn
işleme
79372344b4
1 değiştirilmiş dosya ile 10 ekleme ve 10 silme
  1. 10
    10
      profile/encode.go

+ 10
- 10
profile/encode.go Dosyayı Görüntüle

@@ -237,9 +237,9 @@ func (p *Profile) postDecode() error {
237 237
 		m.BuildID, err = getString(p.stringTable, &m.buildIDX, err)
238 238
 		if m.ID < uint64(len(mappingIds)) {
239 239
 			mappingIds[m.ID] = m
240
-			continue
240
+		} else {
241
+			mappings[m.ID] = m
241 242
 		}
242
-		mappings[m.ID] = m
243 243
 	}
244 244
 
245 245
 	functions := make(map[uint64]*Function, len(p.Function))
@@ -250,9 +250,9 @@ func (p *Profile) postDecode() error {
250 250
 		f.Filename, err = getString(p.stringTable, &f.filenameX, err)
251 251
 		if f.ID < uint64(len(functionIds)) {
252 252
 			functionIds[f.ID] = f
253
-			continue
253
+		} else {
254
+			functions[f.ID] = f
254 255
 		}
255
-		functions[f.ID] = f
256 256
 	}
257 257
 
258 258
 	locations := make(map[uint64]*Location, len(p.Location))
@@ -269,16 +269,16 @@ func (p *Profile) postDecode() error {
269 269
 				l.Line[i].functionIDX = 0
270 270
 				if id < uint64(len(functionIds)) {
271 271
 					l.Line[i].Function = functionIds[id]
272
-					continue
272
+				} else {
273
+					l.Line[i].Function = functions[id]
273 274
 				}
274
-				l.Line[i].Function = functions[id]
275 275
 			}
276 276
 		}
277 277
 		if l.ID < uint64(len(locationIds)) {
278 278
 			locationIds[l.ID] = l
279
-			continue
279
+		} else {
280
+			locations[l.ID] = l
280 281
 		}
281
-		locations[l.ID] = l
282 282
 	}
283 283
 
284 284
 	for _, st := range p.SampleType {
@@ -309,9 +309,9 @@ func (p *Profile) postDecode() error {
309 309
 		for i, lid := range s.locationIDX {
310 310
 			if lid < uint64(len(locationIds)) {
311 311
 				s.Location[i] = locationIds[lid]
312
-				continue
312
+			} else {
313
+				s.Location[i] = locations[lid]
313 314
 			}
314
-			s.Location[i] = locations[lid]
315 315
 		}
316 316
 		s.locationIDX = nil
317 317
 	}