<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>Colas.Nahaboo.net - go</title>
    <subtitle>Colas Nahaboo personal site, with discussions about programming code, web and computing topics, surfing and SUPing, and various musings.</subtitle>
    <link rel="self" type="application/atom+xml" href="https://colas.nahaboo.net/tags/go/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://colas.nahaboo.net"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-08-03T00:00:00+00:00</updated>
    <id>https://colas.nahaboo.net/tags/go/atom.xml</id>
    <entry xml:lang="en">
        <title>gmail-to-fastmail: keep your Gmail labels in sync on Fastmail</title>
        <published>2026-08-03T00:00:00+00:00</published>
        <updated>2026-08-03T00:00:00+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/gmail-to-fastmail-sync-yourlabels/"/>
        <id>https://colas.nahaboo.net/code/gmail-to-fastmail-sync-yourlabels/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/gmail-to-fastmail-sync-yourlabels/">&lt;p&gt;&lt;img src=&#39;gmail-to-fastmail.svg&#39; align=right width=300&gt;I moved to Fastmail some time ago, but like many of us I kept one foot in Gmail: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https://www.fastmail.help/hc/en-us/articles/1500000278022-Using-other-email-addresses-with-fetch&quot;&gt;Fastmail&#39;s &quot;fetch&quot;&lt;/a&gt; tool keeps duplicating my incoming Gmail into my Fastmail account — a backup, an escape plan, and a bridge for family members who are not quite ready to leave Gmail yet.&lt;/p&gt;
&lt;p&gt;But there was a hole: the &lt;strong&gt;labels&lt;/strong&gt; I add on Gmail after the initial migration (manually, or with my rules) were never reproduced on Fastmail. So I wrote &lt;strong&gt;&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https://github.com/ColasNahaboo/gmail-to-fastmail&quot;&gt;gmail-to-fastmail&lt;/a&gt;&lt;/strong&gt;, a single Go binary that incrementally syncs your Gmail labels to Fastmail.&lt;/p&gt;
&lt;h2 id=&quot;how-it-works&quot;&gt;How it works&lt;a class=&quot;zola-anchor&quot; href=&quot;#how-it-works&quot; aria-label=&quot;Anchor link for: how-it-works&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;It reads your Gmail via IMAP (read-only, &lt;code&gt;X-GM-LABELS&lt;/code&gt;), and applies the labels on Fastmail via JMAP (a more efficient variant of IMAP), in batches of 10 000. Progress is kept in a local SQLite database, so each run resumes where the last one stopped — once caught up, a run takes about 15 seconds. Perfect for cron.&lt;/p&gt;
&lt;h2 id=&quot;what-it-does&quot;&gt;What it does&lt;a class=&quot;zola-anchor&quot; href=&quot;#what-it-does&quot; aria-label=&quot;Anchor link for: what-it-does&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Labels mapped&lt;/strong&gt;: your Gmail labels become Fastmail labels, created on demand, never deleted.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Categories&lt;/strong&gt;: Gmail&#39;s system categories (Inbox, Updates, Social...) become underscore-prefixed labels &lt;code&gt;_Inbox&lt;/code&gt;, &lt;code&gt;_Updates&lt;/code&gt;, &lt;code&gt;_Social&lt;/code&gt;...&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Trash&lt;/strong&gt;: emails deleted on Gmail are not deleted on Fastmail, just labelled &lt;code&gt;_Trash&lt;/code&gt; — a backup of your deleted mail, with an easy way to &quot;empty the bin&quot;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Local cache&lt;/strong&gt;: unchanged emails are skipped, so Fastmail&#39;s API is left in peace.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Mirror mode&lt;/strong&gt;: &lt;code&gt;-m&lt;/code&gt;/&lt;code&gt;-M&lt;/code&gt; optionally imports emails missing on Fastmail, not just labels. There are more options, detailed on the GitGub repository.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;installation-usage-and-more-info&quot;&gt;Installation, Usage, and more info&lt;a class=&quot;zola-anchor&quot; href=&quot;#installation-usage-and-more-info&quot; aria-label=&quot;Anchor link for: installation-usage-and-more-info&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;See the &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https://github.com/ColasNahaboo/gmail-to-fastmail&quot;&gt;GitHub repository&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;why-go&quot;&gt;Why Go?&lt;a class=&quot;zola-anchor&quot; href=&quot;#why-go&quot; aria-label=&quot;Anchor link for: why-go&quot;&gt;🔗&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Because it is a single self-contained binary with no runtime dependencies — you know my &lt;a href=&quot;/blog/go-single-binary-fanatic&quot;&gt;thing about that&lt;/a&gt;. No Python env, no node_modules, no nothing. Free (MIT).&lt;/p&gt;
&lt;p&gt;Also, AI co-written: don&#39;t like, don&#39;t use.&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Fanatic of the single self-contained executable</title>
        <published>2026-07-31T00:00:00+00:00</published>
        <updated>2026-07-31T00:00:00+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/blog/go-single-binary-fanatic/"/>
        <id>https://colas.nahaboo.net/blog/go-single-binary-fanatic/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/blog/go-single-binary-fanatic/">&lt;p&gt;I am becoming more and more a fanatic of the single self-contained executable, with no runtime dependencies, that Go provides: one binary, forever. No npm, virtualenv, docker, flatpak, snap... no version hell.&lt;/p&gt;
&lt;p&gt;The qualities I lived with and took for granted during my years of coding in C and shell.&lt;/p&gt;
&lt;p&gt;To the point that when I find now a python/node/java/ruby/php piece of software I would like to install, my first reflex is to just recode the darn thing in Go. I know, I know, rewriting a perfectly working piece of software just to avoid a dependency is bordering on insanity, but the result is so satisfying... A single file that will still run in 20 years, with no upgrades, no breakage, no maintenance.&lt;/p&gt;
&lt;p&gt;And with AI, now, it is becoming less and less insane!&lt;/p&gt;
&lt;p&gt;(&lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https://bsky.app/profile/colas.nahaboo.net/post/3mrxclxl64s2e&quot;&gt;Bluepost &lt;img src=&#39;/icon/social/bluesky-blue.svg&#39;&gt;&lt;/a&gt;)&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Suntimes, a small shell utility</title>
        <published>2022-03-03T00:00:00+00:00</published>
        <updated>2022-03-03T00:00:00+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/suntimes-a-small-shell-utility/"/>
        <id>https://colas.nahaboo.net/code/suntimes-a-small-shell-utility/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/suntimes-a-small-shell-utility/">&lt;p&gt;I just made a small command-line utility to display the sunrise and sunset times at a location. It can be quite useful in shell scripts.&lt;/p&gt;
&lt;p&gt;It is a minimal Go wrapper around the &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https://github.com/nathan-osman/go-sunrise&quot;&gt;nathan-osman/go-sunrise library&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can find it at my repository: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https://github.com/ColasNahaboo/suntimes&quot;&gt;GitHub - ColasNahaboo/suntimes&lt;/a&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Completed the 2015 Advent of Code challenge in GO</title>
        <published>2022-02-24T00:00:00+00:00</published>
        <updated>2022-02-24T00:00:00+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/completed-the-2015-advent-of-code-challenge-in-go/"/>
        <id>https://colas.nahaboo.net/code/completed-the-2015-advent-of-code-challenge-in-go/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/completed-the-2015-advent-of-code-challenge-in-go/">&lt;p&gt;And I completed the 2015 challenge! (see my &lt;a href=&quot;/code/starting-the-2015-advent-of-code-challenge-in-go&quot;&gt;previous post&lt;/a&gt;). You can read my notes on it on my  &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https://github.com/ColasNahaboo/advent-of-code-my-solutions/tree/main/go/2015&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This was quite interesting, and I thing a great way to learn a language just after completing its tutorial, as this challenge as a feel of &quot;real life&quot; situations, and allow for a variety of solutions, so that you can put different approaches to the test.&lt;/p&gt;
&lt;p&gt;I forced myself to not look at the solutions available on the net, except for two cases:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Using working code to generate more data to test against (random inputs + expected result number). I just ran the code of other solutions, without reading their source. I often used  solutions by &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https://github.com/devjobe/advent-of-code-2015-golang&quot;&gt;devjobe&lt;/a&gt; and &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https://github.com/schwern/adventofcode.go&quot;&gt;schwern&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Once I had a working solution, browsing the source code of other solutions to compare with mine and see where I could improve, and discover cool tricks. I mostly used the &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https://www.reddit.com/r/adventofcode/wiki/solution_megathreads/#wiki_december_2015&quot;&gt;reddit megathread&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I also tried to use only the standard Go packages, and not the ones available on the web. I am sure I will end up using 3rd party packages to replace the standard ones (the &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https://pkg.go.dev/flag&quot;&gt;flag package &lt;/a&gt;  to parse options for instance is really too primitive). And I also didn&#39;t create a separate module or package for my library of common useful functions. I will surely do it in the future, but I feel I should have more experience first.&lt;/p&gt;
&lt;p&gt;Anyways, it has confirmed that Go was the language I have been waiting for all these years. On the one hand, I have a bit of regret not having jumped on it sooner, but on the other hand it was easier to just wait for my retirement (one year ago) to free myself from any work politics and constraints to be able to fully explore the programming language landscape with no strings attached.&lt;/p&gt;
&lt;p&gt;I can see myself using 4 languages in the future:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;bash&lt;/strong&gt; for any &quot;glue&quot; tooling and scripts.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;go&lt;/strong&gt; for my main do-it-all language, and web backend.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;javascript&lt;/strong&gt; (and/or WebAssembly) for my web frontend, with pure modern HTML and CSS, but no framework, à la  &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;http://vanilla-js.com/&quot;&gt;Vanilla JS&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;and maybe a higher performance, specialized language, if I encounter such needs: E.g: &lt;strong&gt;zig&lt;/strong&gt; as a replacement of C for tasks where Go could be unsuited (if I encounter any), or &lt;strong&gt;julia&lt;/strong&gt; for math-specific things, etc...&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Edit: I see that Neil Henning also enjoyed discovering a new language via AoC: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https://www.duskborn.com/posts/2021-aoc-zig/&quot;&gt;A Review of the Zig Programming Language (using Advent of Code 2021)&lt;/a&gt;&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Starting the 2015 Advent of Code challenge in GO</title>
        <published>2022-02-09T00:00:00+00:00</published>
        <updated>2022-02-09T00:00:00+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://colas.nahaboo.net/code/starting-the-2015-advent-of-code-challenge-in-go/"/>
        <id>https://colas.nahaboo.net/code/starting-the-2015-advent-of-code-challenge-in-go/</id>
        
        <content type="html" xml:base="https://colas.nahaboo.net/code/starting-the-2015-advent-of-code-challenge-in-go/">&lt;p&gt;I discovered the &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https://adventofcode.com/&quot;&gt;advent of code&lt;/a&gt; in 2021, and did it in &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https://github.com/ColasNahaboo/advent-of-code-my-solutions/tree/main/bash&quot;&gt;bash&lt;/a&gt; for the challenge. But since I started learning GO, I decided to code the previous AoC years in GO as a mean to practice it. So, although my bash code can be useful to see some tricks of a seasoned bash programmer, these GO solutions must be considered as &quot;student code&quot;.&lt;/p&gt;
&lt;p&gt;So I started coding the 2015 year of AoC in GO, available on my GitHub: &lt;a rel=&quot;noopener external&quot; target=&quot;_blank&quot; href=&quot;https://github.com/ColasNahaboo/advent-of-code-my-solutions/blob/main/go/2015&quot;&gt;advent-of-code-my-solutions/go/2015&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The code is in GO, with some housekeeping scripts in bash.&lt;/p&gt;
</content>
        
    </entry>
</feed>
