Google Go = Golang

The Google Go language.

Go internals unofficial wiki restored

Submitted by Frederic Marand on

The "Go internals unofficial wiki" on goin.wikispot.org used to be a valuable resource for developers interesting in the internal operation of the Go runtime, but disappeared when wikispot.org went down in 04/2014.

I spent a couple of hours this morning to restore and reformat its contents to the Golang section on the Audean wiki.

Enjoy... but responsibly : its content was fresh in 2014, not last week...

GoLand tip of the day: clean up GoLand leftover cache and log folders

Submitted by Frederic Marand on

When GoLand is upgraded from one version to the next, the deployment process adds a new set of configuration, cache, and log directories. But it does not remove the versions associated to the previous versions of the IDE, to ease rolling back to the previous version if an upgrade happens to cause an issue.

So after some time, removing these now-unused folders will regain some disk space, possibly more than 1 GB. Here are their respective locations and content on macOS:

GoLand tip of the day: when Make run configurations don't find go

Submitted by Frederic Marand on

The problem

In a GoLand 2018.3 EAP run configuration, a Makefile run configuration finds the go binary on macOS, but not on Ubuntu, causing make targets like this one to fail:
client/test.wasm: client/main.go
# Building WASM
GOARCH=wasm GOOS=js go build -o client/test.wasm client/main.go

/usr/bin/make -f (some edited path)/Makefile client/test.wasm
/bin/sh: 1: go: not found
make: *** [client/test.wasm] Error 127

Simple enough to fix...

Golang tip of the day; PHP-compatible crc32

Submitted by Frederic Marand on

While porting (well, actually rewriting) an old PHP library to Go, I had to use a CRC (cyclic redundancy check) on a buffer. In old-school PHP, the standard is well established since PHP 4: just use crc32 from the strings package, and beware of the sign bit or, to be a bit more current while still compatible, use the hash() function from the hash package, like this example:

Go tip of the day : running tests for all subpackages recursively

Submitted by Frederic Marand on

If you program in Go, you've probably written a lot of packages, and probably split packages in subpackages. Maybe even more than idiomatic Go would really advise... And you may have been grumbling just like I did at the fact that the go test command requires a list of packages, and does not recursively dive into all the subpackages, like PHPunit would, and does not seem to have a working recursion flag.