• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Go Gotchas

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've been using Go irregularly for about a year and I like it a lot. I have yet to really dive in deep with it.

I've found a few "Gotchas" on my own, and wonder if you could share what you think are the biggest gotchas.

The biggest Gotchas I've found is this:



I understand why this is, but I nevertheless make the mistake.
 
Author
Posts: 14
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On Gotcha that I had to learn early on is that the application exits when main finishes. Even when there are concurrent goroutines doing work you intend. To avoid that there are ways to make sure main waits for the other work to finish before exiting.

Because of the way Go handles concurrency that can run on multiple threads this seemed like a fairly unique one to Go. We do cover waiting in Go in Practice.

This was one I had to learn the hard way.
 
And when my army is complete, I will rule the world! But, for now, I'm going to be happy with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic