title: Golang difference between timer expired VS stopped?
body: <p>Based on this example (<a href="https://gobyexample.com/timers" rel="nofollow noreferrer">https://gobyexample.com/timers</a>), the timer can be either stopped or expired. But what are the differences?</p>
  
  <pre><code>package main
  import "time"
  import "fmt"
  
  func main() {
      timer1 := time.NewTimer(time.Second*2)
  
      &lt;-timer1.C
      fmt.Println("Timer 1 expired")
  
      timer2 := time.NewTimer(time.Second)
      go func() {
          &lt;-timer2.C
          fmt.Println("Timer 2 expired")
      } ()
      stop2 := timer2.Stop()
      if stop2 {
          fmt.Println("Timer 2 stopped")
      }
  }
  </code></pre>