Go SDK panics with: unaligned 64-bit atomic operation on x86_64 Ubuntu Server

The problem manifests because of the 32-bit (GOARCH=386) build; Is there a reason for needing a 32-bit build ?
You can demo the issue in Go simply with:

package main;
import "sync/atomic"
type Eg struct {
        u32 uint32
        u64 uint64
}
func main() {
        var eg Eg
        atomic.StoreUint64(&eg.u64, uint64(0))
}

Which when built with:

GOOS=linux GOARCH=386 go build eg.go

Will panic similarly - since go structure members aren’t 64-bit aligned in a 32-bit build.
(If built with GOARCH=amd64 of course it works.)

HTH.

1 Like