Google Go = Golang

The Google Go language.

Error handling in Go 1.14 (french) Frederic Marand Thu, 2020-02-27 08:33

La gestion des erreurs en Go 1.14 ne se limite plus à l'interface error: découvrez l'ensemble des mécanismes disponibles.

Découvrez les statistiques de l'interface error, et les tentatives qui ont abouti aux nouvelles fonctions du paquet errors: Unwrap, As, Is et le nouveau format "%w".

Go internals unofficial wiki restored Frederic Marand Mon, 2019-03-04 12:09

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 Frederic Marand Sat, 2018-12-08 17:10

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 Frederic Marand Fri, 2018-10-12 13:31

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 Frederic Marand Sun, 2015-05-31 17:28

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 Sat, 2014-09-27 23:52

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.

Calling methods on null objects in Go and PHP Frederic Marand Sat, 2014-09-20 11:07

Call a method on a nil pointer (null object) ? This is a classical bug. What if it somehow turned out to be a valid and useful construct in some languages, say in Go ? And what about PHP ?

Golang tip of the day: admin dashboard and health checks in Beego applications Frederic Marand Sun, 2014-07-06 12:23

One litle-publicized feature of the BeeGo Go framework is its admin dashboard.

Features

Although it may look quite raw visually (think MIME: text/plain), it contains a wealth of information about goroutines, threads, memory usage, and request statistics. It even allows devs to add to a "healthcheck" list, and admins allowed dashboard access to run "tasks" defined in code. The diagram belows shows the hierarchy of features in the version coming with Beego 1.3.0.

What to do when Go will not run, nor install from source ? Frederic Marand Fri, 2014-06-06 16:39

Some days ago, at the AWS Summit 2014, DamZ renewed my long-sleeping interest for the Google Go language with wonderous stories about its use in infrastructure of the new Commerce Guys Platform they were launching that same days, so I've been doing my homework getting up to date on Go programming: that's what holidays are for, aren't they ?