If you need to loop forever, or infinitely, in your Go code, then you have 2 options:

Option 1:

1
2
3
for {
  // your code here
}

Option 2:

1
2
3
for true {
  // your code here
}

Just remember that you need to break out of this, otherwise it really will run forever!

How to use in a Go Application

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
package main

func main() {

  // OPTION 1
  for {
    // your code here
  }

  // OPTION 2
  for true {
    // your code here
  }

}