Golang News http://golangnews.com Jobs, Code, Videos and News for Go hackers - everything about the go programming language Fri, 21 Oct 2022 15:55:00 +0000 Tip of the day: running Flagr Docker image on a M1 mac #docker #containers Flagr is a Go-based feature flags service, which is by default deployed as a Docker image. However, the image is not built for darwin/arm64/8. Here is how to run the server without going through a source build. 1 points posted by FGM https://blog.riff.org/2022_10_21_tip_of_the_day_running_flagr_docker_image_on_a_m1_mac 4775 Fri, 21 Oct 2022 15:53:00 +0000 What to do when Go itself will not run nor install from source <p>This morning it was time to consider deploying a project to production... but alas, programs which worked normally on an Ubuntu development workstation failed to run on the target server, running Debian. Both of them were running Linux kernels 3.2.x for x86_64, and the binary worked on one, but not the other:</p> <pre>ls -l myapp -rwxrwxr-x 1 root root 3522952 Jun&nbsp; 6 11:32 myapp $ ./myapp bash: ./myapp: no such file or directory $ strace -f -e open ./myapp exec: no such file or directory $ file myapp ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), not stripped $ ldd myapp<br style="font-size: 12px; background-color: rgb(248, 248, 255);">ldd:<br style="font-size: 12px; background-color: rgb(248, 248, 255);"> not a dynamic executable<br style="font-size: 12px; background-color: rgb(248, 248, 255);"></pre> <p>So, for "file", this is an dynamically linked executable, but not for ldd ? And, even more surprising, a trivial <code style="font-size: 13.12px; background-color: rgb(248, 248, 255); border: none; box-shadow: rgb(89, 142, 189) 0.05em 0.05em 0.5em; padding: 0.2em 0.5em;">helloworld.go</code>&nbsp;compiled the same way worked on both machines. What could be going wrong ? Anyway, let's just compile... but then the Go 1.0 package for Debian itself fails with the same symptoms. Let's find out how to fix this...<br></p> 5 points posted by FGM https://blog.riff.org/2014_06_06_what_to_do_when_go_will_not_run_nor_install_from_source 3336 Thu, 10 May 2018 18:48:00 +0000 Goland tip of the day: when Make run configurations dont find "go" #goland In a Goland 2018.3 EAP run configuration, a Makefile run configuration finds the <code>go</code>&nbsp;binary on macOS, but not on Ubuntu, causing lines tasks this one builds to fail:<br><pre>client/test.wasm: client/main.go<br> # Building WASM<br> GOARCH=wasm GOOS=js go build -o client/test.wasm client/main.go<br><br>/usr/bin/make -f (some edited path)/Makefile client/test.wasm<br>/bin/sh: 1: go: not found<br>make: *** [client/test.wasm] Error 127<br></pre> <p>Let's fix it...</p> 4 points posted by FGM https://blog.riff.org/2018_10_12_goland_tip_of_the_day_when_make_run_configurations_dont_find_go 3608 Sun, 14 Oct 2018 10:27:00 +0000 Go internals unofficial wiki restored <p>The <i>"Go internals unofficial wiki"</i>&nbsp;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.</p> <p>It is now available in wiki form again on the <a href="https://wiki.audean.com/go/internals">Golang section on the Audean wiki</a>.</p><div><br></div> 3 points posted by FGM https://blog.riff.org/2019_03_04_go_internals_unofficial_wiki_restored 3822 Mon, 04 Mar 2019 11:14:00 +0000 GoLand tip of the day: clean up leftover cache and log folders #goland <p>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.</p> <p>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...</p> 2 points posted by FGM https://blog.riff.org/2018_12_08_goland_tip_of_the_day_clean_up_goland_leftover_cache_and_log_folders 3709 Sat, 08 Dec 2018 17:26:00 +0000 Tip of the day: running tests for all subpackages recursively #tests <br class="Apple-interchange-newline">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 <code>go test</code>&nbsp;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... 2 points posted by FGM https://blog.riff.org/2014_09_27_go_tip_of_the_day_running_tests_for_all_subpackages_recursively 3695 Thu, 29 Nov 2018 10:13:00 +0000