Golang News http://golangnews.com Jobs, Code, Videos and News for Go hackers - everything about the go programming language Sun, 13 Mar 2022 19:36:00 +0000 The Go 1.18 generics landscape A fairly complete presentation about Go 1.18 generics including examples, planned changes for future releases, writing generics code, defining&nbsp;constraints,&nbsp;new library packages, and generics examples for generics Map() / Reduce() / Filter()&nbsp; and a type-safe Set implementation. 4 points posted by FGM https://osinet.fr/go/en/articles/go1.18-generics-intro 4688 Fri, 04 Feb 2022 09:44:00 +0000 Plotting go test coverage over time #testing #howto #observability <p>The Go SDK has been including test coverage reports since <a href="https://go.dev/blog/cover" style="box-sizing: inherit; color: rgb(0, 162, 156);">Go 1.2</a>.</p> <p>How can we obtain a time graph of test coverage, without needing a SaaS service? Enter https://gitlab.com/fgmarand/gocoverstats ...</p> 4 points posted by FGM https://osinet.fr/go/en/articles/plotting-go-test-coverage 4681 Sun, 16 Jan 2022 20:24:00 +0000 Bundling templates with embed #embed #howto #assets If you've been embedding assets  or templates with rakyll/statik, markbates/pkger or any other bundler, you will probably want to convert to the new embed package brought by Go 1.16 to replace them all. This article, following one about pkger, explains how, going through the exact same steps to make converting easier. 4 points posted by FGM https://osinet.fr/go/en/articles/bundling-templates-with-embed 4673 Mon, 03 Jan 2022 12:47:00 +0000 Creating CLI commands, subcommands and flags with google/subcommands #cli <p>How to create CLI programs with multiple commands, flags and subcommands, and do it fast and simply?</p> <p><a href="https://github.com/google/subcommands" style="box-sizing: inherit; color: rgb(0, 162, 156);">google/subcommands</a>&nbsp;makes it a breeze.</p> <p>Let us see how.</p> 3 points posted by FGM https://osinet.fr/go/en/articles/cli-google-subcommands 4697 Sun, 06 Mar 2022 13:35:00 +0000 Bundling templates with pkger #assets, #pkger <p>Resource embedding tools like <code style="box-sizing: inherit; background-color: rgb(250, 250, 250); font-family: Hugo, Menlo, monospace;">pkger</code> allow developers to include static assets and other unpublished files like templates in their executable programs. Let’s see how.</p> 4 points posted by FGM https://osinet.fr/go/en/articles/bundling-templates-with-pkger 4465 Tue, 06 Oct 2020 07:53:00 +0000 A PHP-compatible CRC32 version in Go <h1>A PHP-compatible CRC32 version in Go</h1> 4 points posted by FGM https://osinet.fr/go/en/articles/trucs/php-crc32 4435 Fri, 28 Aug 2020 16:09:00 +0000 How to debug a second test run ? #test #testing #delve #goland #debugging Sometimes, tests can succeed on the first run and fail on subsequent ones, or with the -shuffle flag. But then, how can one debug them using the builtin Delve in GoLand while run configurations only run tests once ? 1 points posted by FGM https://osinet.fr/go/en/articles/debug-second-test 4739 Thu, 09 Jun 2022 11:22:00 +0000 Comment déboguer la seconde exécution d'un test #delve #goland #debugging Parfois, des tests peuvent réussir à la première passe et échouer à la suivante, ou dans un autre ordre. Mais comment les déboguer avec Delve et GoLand alors que les configurations d'exécution n'exécutent les tests qu'une seule fois ?  1 points posted by FGM https://osinet.fr/go/articles/debug-second-test 4733 Wed, 01 Jun 2022 17:36:00 +0000