<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Go on Miek Gieben</title>
    <link>https://miek.nl/tags/go/</link>
    <description>Recent content in Go on Miek Gieben</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <copyright>© Copyright 2007-2024 Miek Gieben</copyright>
    <lastBuildDate>Fri, 14 Mar 2025 12:14:47 +0100</lastBuildDate>
    <atom:link href="https://miek.nl/tags/go/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>PAM unixsock</title>
      <link>https://miek.nl/2025/march/14/pam-unixsock/</link>
      <pubDate>Fri, 14 Mar 2025 12:14:47 +0100</pubDate>
      <guid>https://miek.nl/2025/march/14/pam-unixsock/</guid>
      <description>&lt;p&gt;Ever felt the need to do something with PAM, like implementing 2FA in SSH? You are left with a few&#xA;bad choices, among others you&amp;rsquo;ll need to write something (complex) in C. I rather not do that, so&#xA;I&amp;rsquo;ve created &lt;a href=&#34;https://github.com/miekg/pam-unixsock&#34;&gt;pam-unixsock&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This is &lt;em&gt;tiny&lt;/em&gt;, the most trouble I had with concatenating strings with a space in between,&#xA;because, you know, C. Anyway &lt;em&gt;tiny&lt;/em&gt;. It doesn&amp;rsquo;t do much and gets you into another language quickly!&lt;/p&gt;</description>
    </item>
    <item>
      <title>Format Go HTML templates</title>
      <link>https://miek.nl/2025/february/19/format-go-html-templates/</link>
      <pubDate>Wed, 19 Feb 2025 15:20:33 +0100</pubDate>
      <guid>https://miek.nl/2025/february/19/format-go-html-templates/</guid>
      <description>&lt;p&gt;Because I was fed up with the lack of options (none), I write a tool that&#xA;can format Go HTML templates: you can find it &lt;a href=&#34;https://github.com/miekg/gotmplfmt&#34;&gt;here&lt;/a&gt;. Includes&#xA;screenshots!&lt;/p&gt;&#xA;&lt;p&gt;Formatting Go &lt;em&gt;text&lt;/em&gt; templates is pure madness, but the above code works well on HTML templates. If&#xA;have find issues or need more functionality open a PR against the repo.&lt;/p&gt;&#xA;&lt;p&gt;Have this in neovim:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-vim&#34; data-lang=&#34;vim&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;au&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;FileType&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;gohtmltmpl&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;command&lt;/span&gt;! &lt;span style=&#34;color:#a6e22e&#34;&gt;Fmt&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;silent&lt;/span&gt; %!&lt;span style=&#34;color:#a6e22e&#34;&gt;gotmplfmt&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;au&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;FileType&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;gohtmltmpl&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; &amp;amp;&lt;span style=&#34;color:#a6e22e&#34;&gt;l&lt;/span&gt;:&lt;span style=&#34;color:#a6e22e&#34;&gt;formatprg&lt;/span&gt;=&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;gotmplfmt&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;update-2025-05-31&#34;&gt;Update 2025-05-31&lt;/h2&gt;&#xA;&lt;p&gt;In my new neovim setup (with conform.lua) I have this:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Kong Go CLI manual pages</title>
      <link>https://miek.nl/2024/november/08/kong-go-cli-manual-pages/</link>
      <pubDate>Fri, 08 Nov 2024 11:38:55 +0100</pubDate>
      <guid>https://miek.nl/2024/november/08/kong-go-cli-manual-pages/</guid>
      <description>&lt;p&gt;I&amp;rsquo;m using &lt;a href=&#34;https://github.com/alecthomas/kong&#34;&gt;Kong the CLI argument parser&lt;/a&gt; to create manual pages&#xA;from the arguments and help described in the Kong structure that tells your CLI how to parse its command&#xA;line.&lt;/p&gt;&#xA;&lt;p&gt;With a lot of use from the &lt;code&gt;reflect&lt;/code&gt; package (this was before I discovered kong actually has an API&#xA;you can use), I&amp;rsquo;m creating manual pages from the kong CLI definition, while having great fun with&#xA;parsing &lt;code&gt;enum&lt;/code&gt;, &lt;code&gt;default&lt;/code&gt; and other tags to make the manual page really readable.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Kong Go CLI</title>
      <link>https://miek.nl/2024/november/01/kong-go-cli/</link>
      <pubDate>Fri, 01 Nov 2024 11:38:55 +0100</pubDate>
      <guid>https://miek.nl/2024/november/01/kong-go-cli/</guid>
      <description>&lt;p&gt;I&amp;rsquo;m a fan of &lt;a href=&#34;https://github.com/alecthomas/kong&#34;&gt;Kong the CLI argument parser&lt;/a&gt;, I use it to&#xA;automatically create manual pages, (bash) completion and do a lot of validation inside it. (This guy&#xA;also has other really interesting packages, and he&amp;rsquo;s a huge fan of Go&amp;rsquo;s struct tags).&lt;/p&gt;&#xA;&lt;p&gt;I wanted to do validation inside Kong as well, for this Kong has&#xA;&lt;a href=&#34;https://github.com/alecthomas/kong?tab=readme-ov-file#validation&#34;&gt;validation&lt;/a&gt;, which is just a&#xA;method (&lt;code&gt;Validate() error&lt;/code&gt;) on a type. Now most types I have are just &lt;code&gt;string&lt;/code&gt; or any other builtin&#xA;type. For validation to work, all these types must be re-typed to another type on which the method&#xA;can be applied, which is annoying. I wanted a better way&amp;hellip;&lt;/p&gt;</description>
    </item>
    <item>
      <title>eBPF in Go</title>
      <link>https://miek.nl/2024/august/22/ebpf-in-go/</link>
      <pubDate>Thu, 22 Aug 2024 18:46:57 +0200</pubDate>
      <guid>https://miek.nl/2024/august/22/ebpf-in-go/</guid>
      <description>&lt;p&gt;What if I could program eBPF in &lt;em&gt;pure&lt;/em&gt; Go? I want to use eBPF and lots of current tooling exist, but&#xA;I like Go. I don&amp;rsquo;t want to use clang to create the ELF binary that then gets loaded into the Linux&#xA;kernel. I want to use Go to create that ELF file. The heavy lifting of loading and&#xA;inspecting can be done via bpftool (although I&amp;rsquo;m aware that Go programs exist that do this), but&#xA;bpftool looks like the standard way of interacting with the kernel&amp;rsquo;s eBPF subsystem.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
