214 Name: mnt.Name,
215 Region: region,
216 SizeGb: &mnt.SizeGb,
217 Encrypted: &mnt.Encrypted,218 SnapshotID: snapshotID,
219 RequireUniqueZone: fly.Pointer(flag.GetBool(ctx, "volume-requires-unique-zone")),
220 ComputeRequirements: targetConfig.Guest,
213 volInput := fly.CreateVolumeRequest{
214 Name: mnt.Name,
215 Region: region,
216 SizeGb: &mnt.SizeGb,217 Encrypted: &mnt.Encrypted,
218 SnapshotID: snapshotID,
219 RequireUniqueZone: fly.Pointer(flag.GetBool(ctx, "volume-requires-unique-zone")),
436 if orgID != nil {
437 return errors.New("multiple org caveats")
438 }
439 orgID = &cav.ID440 }
441 if orgID == nil {
442 return errors.New("no org caveats")
Range variables in a loop are reused at each iteration. This rule warns when assigning the address of the variable, passing the address to append() or using it in a map.
m := map[string]*string{}
mySlice := []string{"A", "B", "C"}
for _, value := range mySlice {
m["address"] = &value // value always has the same address
}
m := map[string]*string{}
mySlice := []string{"A", "B", "C"}
for _, value := range mySlice {
value := value
m["address"] = &value // value always has the same address
}
m := map[string]*string{}
mySlice := []string{"A", "B", "C"}
for i := range mySlice {
m["address"] = &mySlice[i] // value always has the same address
}