How to Build for Linux 32-Bit with Go1.6.2

How can I build for linux 32-bit with go1.6.2

GOOS=linux and GOARCH=386.

More examples: architecture:

32-bit -> GOARCH=386
64-bit -> GOARCH=amd64

OS:

Windows -> GOOS=windows
Linux -> GOOS=linux
OS X -> GOOS=darwin
FreeBSD -> GOOS=freebsd

For the complete list (valid "individual" values) refer to go/build/syslist.go file:

const goosList = "android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows "
const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc s390 s390x sparc sparc64 "

Note that the above list is an ever-growing list, platforms not supported anymore are not removed (as that list is used for go/build filename matching).

For the current list all supported platforms (GOOS/GOARCH combinations), use the following command:

go tool dist list

The valid combinations of GOOS + GOARCH (source):

$GOOS   $GOARCH
darwin 386
darwin amd64
darwin arm
darwin arm64
dragonfly amd64
freebsd 386
freebsd amd64
freebsd arm
linux 386
linux amd64
linux arm
linux arm64
linux ppc64
linux ppc64le
linux mips64
linux mips64le
netbsd 386
netbsd amd64
netbsd arm
openbsd 386
openbsd amd64
openbsd arm
plan9 386
plan9 amd64
solaris amd64
windows 386
windows amd64

How to reduce Go compiled file size?

Note: This answer is outdated

Please note that this answer is outdated. Please refer to the other higher-voted answers. I would like to delete this post, accepted answers can't be deleted though.


Is it a problem that the file is larger? I don't know Go but I would assume that it statically links some runtime lib which is not the case for the C program. But probably that is nothing to worry about as soon as your program gets larger.

As described here, statically linking the Go runtime is the default. That page also tells you how to set up for dynamic linking.

Docker ERROR: Error processing tar file(exit status 1): unexpected EOF

There is an built in command to remove unused images (Version 1.13+):

docker image prune

Now to handle the situation:

  • Stop Docker Service

    systemctl stop docker
  • Backup /var/lib/docker then:

  • Remove /var/lib/docker
    Caution: This will remove images, containers, volumes, ... make sure you back it up first.

    rm -rf /var/lib/docker
  • Start Docker service

    systemctl start docker  

Update:

As noted in the other answer, In somecases it might be file permissions issue. Please review permissions.



Related Topics



Leave a reply



Submit