fbpx

Go without C

Go without C

Google’s up and coming programming language Go is now available at version 1.5, with one very noticeable change – no more C. The team behind Google’s open source, low-level language project has called it a significant release.

Google’s Go 1.5 is here and with it, some significant changes to its architectural implementation, minus the C programming language. The team has assured users that thanks to its promise of compatibility, programs will continue to compile and run as normal.

UPDATE! Andrew Gerrand from the Go team has updated the official Go Blog with their release news, however release notes have been available to view since early July.

Implementation details

The biggest change highlighted by the team is undoubtedly the fact that both the compiler and runtime are now completely written in Go, thus saying goodbye to C for good. A little cameo of assembler is in there for good measure, too.

The small amount of C left over after the overhaul can be found related to testing or to cgo. The compiler of previous versions consisted of C in the tree, which was used to build the runtime; “a custom compiler was necessary in part to guarantee the C code would work with the stack management of goroutines“.

The conversion from C was done with the help of custom tools created for the job. Most important, the compiler was actually moved by automatic translation of the C code into Go. It is in effect the same program in a different language. It is not a new implementation of the compiler so we expect the process will not have introduced new compiler bugs.

The complete rundown of the process to eliminate C was written by Russ Cox and can be found here.

Other major changes that feature in this shipment include the garbage collector being re-engineered and now concurrent, providing dramatically lower pause times by running in parallel with other goroutines when possible.

Expected latencies will be much lower now than in previous releases, thanks to some advanced algorithms, better scheduling, and running more of the garbage collection in parallel with the user program. User-responsive web sites are said to be amongst the beneficiaries of such changes.

Finally the runtime, now completely written in Go, has switched up the order in which goroutines are scheduled. While the properties of the scheduler were never purposely defined, users have been warned that programs depending on the previous scheduling pattern might be broken with this change. Updates are recommended.

Further changes documented in the release notes are as follows:

  • Support for internal packages is now provided for all repositories
  • The gocommand now provides experimental support for “vendoring” external dependencies
  • A new go tool tracecommand supports fine-grained tracing of program execution
  • A new go doccommand is now customised for command-line use

The release schedule has been shaken up a little with Go 1.5; more time was needed to prepare for this major release, so the schedule has now been shifted to time the release dates more appropriately.