Skip to content

Resolved Development Issues

Apurer edited this page Jul 6, 2020 · 3 revisions

Go package not updating to the latest commit

Solution:

  • Get latest commit id - it can be any branch:commit id example image
  • Assemble go get command with target repository and addition of @your_commit_id
  • Example of full command: go get -u github.com/Apurer/twitch@bc446e527ec0d527d1626859d70e7ab657f01f09

Go channel not passing value / stopping execution of other code within loop

Solution:

  • Use self invoking function with go routine and loop inside
  • Example:
go func() {
  for {
    select {
    case write := <-w:
    fmt.Fprintf(con, fmt.Sprintf("PRIVMSG #%s :%s\r\n", channel, write))
    }
  }
}() 
  • Not only select on channel stops execution of other code but getting value from channel itself does it as well
  • Does not apply when passing value to channel