Skip to content

Commit 51af642

Browse files
committed
Replace for ;; with for range int in atomic counters
I believe this to be more idiomatic of Go since it was introduced.
1 parent bd94e3e commit 51af642

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

examples/atomic-counters/atomic-counters.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ func main() {
2525

2626
// We'll start 50 goroutines that each increment the
2727
// counter exactly 1000 times.
28-
for i := 0; i < 50; i++ {
28+
for range 50 {
2929
wg.Add(1)
3030

3131
go func() {
32-
for c := 0; c < 1000; c++ {
32+
for range 1000 {
3333

3434
// To atomically increment the counter we use `Add`.
3535
ops.Add(1)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
3435537238237eb363f652dddb405788fec98c8b
2-
HWE6h4-y-Fw
1+
cb0a6d420c43d4d3128266738622a6a45b56bcfd
2+
MmpbKHe1ldr

public/atomic-counters

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)