1. 9
  1.  

  2. 8

    I’ll go ahead and say that this is usually a Bad Idea. While the CGO interface isn’t difficult to use, it does make it much more difficult to deploy your Go program, as cross compilation becomes much more difficult. I’d suggest that you only drop into C if you really need to.

    1. 2

      Is there even a way to do cross compilation with CGO? The last time I tried, CGO is turned off when you try to cross compile because the path to the C compiler is hard-coded in for some reason.

      1. 3

        This is scheduled to be fixed for GO 1.3, assuming it can be made reliable enough in time.

        http://code.google.com/p/go/issues/detail?id=4714

        1. 1

          There are ways, but it’s not pretty.

        2. 1

          I just skimmed the article but I didn’t see where he tried to optimize or analyze the Go program to see where those 3 pesky microseconds went missing. As you mentioned, the extra overhead of builds and deployment are often not worth it… especially not for 3 microseconds.

          1. -3

            There must be a very time-critical problem to rewrite it’s solution from Go to C.