<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Step Into Dev</title><link>https://stepinto.dev/</link><description>Recent content on Step Into Dev</description><generator>Hugo</generator><language>en-gb</language><lastBuildDate>Mon, 16 Nov 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://stepinto.dev/index.xml" rel="self" type="application/rss+xml"/><item><title>Heater Playground 2</title><link>https://stepinto.dev/heater/2/</link><pubDate>Mon, 16 Nov 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/heater/2/</guid><description>&lt;p&gt;The room on the left is a simulation with constants you choose and the model&#10;never sees. Record some logs from it, train the four-weight model from the&#10;&lt;a href="https://stepinto.dev/series/understanding-world-models/"&gt;world models series&lt;/a&gt; on them, and the&#10;chart on the right shows how well it predicts a room outside the training&#10;range, next to the hand-written guess from the &lt;a href="https://stepinto.dev/posts/world-models-101/"&gt;101 post&lt;/a&gt;.&#10;Switch to the room with a door and the model gets a private field, from the&#10;&lt;a href="https://stepinto.dev/posts/world-models-104/"&gt;104 post&lt;/a&gt;, and the chart shows it working out a door the&#10;log never mentioned. Training there also fits the physics-shaped model from the&#10;&lt;a href="https://stepinto.dev/posts/world-models-107/"&gt;107 post&lt;/a&gt;, and the last section puts a planner on it&#10;and compares it with a thermostat over an evening.&lt;/p&gt;</description></item><item><title>Planning Against the Model</title><link>https://stepinto.dev/posts/world-models-107/</link><pubDate>Mon, 16 Nov 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/world-models-107/</guid><description>&lt;p&gt;The &lt;a href="https://stepinto.dev/posts/world-models-106/"&gt;last post&lt;/a&gt; gave Claude the room with the door and lost the first round. Claude fitted the physics from six readings, and my thirteen-weight model from &lt;a href="https://stepinto.dev/posts/world-models-104/"&gt;104&lt;/a&gt;, handed to Claude as a tool, talked it into a heating plan that left the room at 10.6 degrees. The second round went the other way once the model borrowed the shape Claude had described: a leak proportional to the gap between inside and outside, a constant from the heater, and a second leak that comes and goes. That model got one code snippet and one table at the end of a long post, and a promise that this one would build it properly and put a planner on top.&lt;/p&gt;</description></item><item><title>The EU Has an AI Act, the UK Has Regulators and No Bill</title><link>https://stepinto.dev/posts/eu-and-uk-ai-regimes-outlined/</link><pubDate>Fri, 13 Nov 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/eu-and-uk-ai-regimes-outlined/</guid><description>&lt;p&gt;Say you are building an AI product on a model you did not train, calling it through another company&amp;rsquo;s API, and you sell the product in the UK and the EU. Which legislation applies to it, and who is responsible under it, you or the company that trained the model?&lt;/p&gt;&#10;&lt;p&gt;Both regimes apply, and for the product the responsible party is you. The EU AI Act calls you the provider of an AI system, and the company that trained the model has separate duties of its own. The UK has no AI act, so there the answer comes from the laws and regulators that already covered your sector. The rest of this post sets out both regimes and where your product sits in each.&lt;/p&gt;</description></item><item><title>A Claude Client in One Rust File, and the First Dependency</title><link>https://stepinto.dev/posts/claude-hot-path-rust/</link><pubDate>Thu, 12 Nov 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/claude-hot-path-rust/</guid><description>&lt;p&gt;Bash, C# and Go all had HTTP and TLS in their standard libraries, but unfortunately Rust doesn&amp;rsquo;t. &lt;a href="https://stepinto.dev/claude-hot-path/#spec"&gt;The spec&lt;/a&gt; lets a language without them use one named library for the transport, and that library counts towards size, so this is the first time the leaderboard has to price a dependency. The transport is &lt;code&gt;ureq&lt;/code&gt; with rustls, the parsing is &lt;code&gt;serde_json&lt;/code&gt;, and together they bring in thirty-six crates. The result is still the smallest thing on the board so far.&lt;/p&gt;</description></item><item><title>A Faster C# Claude Client, by Breaking the Rules</title><link>https://stepinto.dev/posts/claude-hot-path-csharp-tuned/</link><pubDate>Wed, 11 Nov 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/claude-hot-path-csharp-tuned/</guid><description>&lt;p&gt;Last week I wrote the &lt;a href="https://stepinto.dev/posts/claude-hot-path-csharp/"&gt;C# client&lt;/a&gt; for the hot path the way Microsoft&amp;rsquo;s templates say to write it: &lt;code&gt;HttpClient&lt;/code&gt;, &lt;code&gt;System.Text.Json&lt;/code&gt; nodes, a &lt;code&gt;StreamReader&lt;/code&gt;, &lt;code&gt;Console.Out&lt;/code&gt;, Native AOT with the size-oriented settings. That was the point of it, since the series measures what each language gives you out of the box, and out of the box C# landed at 7.1 ms on the path against Go&amp;rsquo;s 4.4. I put the extra down to the loader resolving glibc and the AOT runtime starting up, and left it there, though it nagged at me all week.&lt;/p&gt;</description></item><item><title>Your Name on a Seville Street Sign, Painted by Rule</title><link>https://stepinto.dev/posts/type-a-word-get-the-wall/</link><pubDate>Wed, 11 Nov 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/type-a-word-get-the-wall/</guid><description>&lt;p&gt;I have been building a series of pages where the computer generates the pattern: &lt;a href="https://stepinto.dev/posts/tiles-painted-by-rule/"&gt;tin-glazed tiles painted by rule&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/cut-tile-and-poured-cement/"&gt;cut tile and poured cement&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/heraldry-by-rule/"&gt;heraldry&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/knotwork-by-rule/"&gt;knotwork&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/a-piece-that-breaks-another-piece/"&gt;a piece that breaks another piece&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/light-on-brick-paint-on-cream/"&gt;brick in raking light&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/the-seventeen-ways-a-wall-can-repeat/"&gt;the seventeen ways a wall can repeat&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/iron-and-silk/"&gt;iron and silk&lt;/a&gt; and &lt;a href="https://stepinto.dev/posts/clay-in-clay/"&gt;clay in clay&lt;/a&gt;. Every one of those grows a repeat from a seed. This one starts from a word, which does not repeat: &lt;a href="https://stepinto.dev/art/letras.html"&gt;Azulejos de letras&lt;/a&gt; is the Seville street sign, with the street name typed in.&lt;/p&gt;</description></item><item><title>Range-Over-Func Iterators for People Who Miss LINQ</title><link>https://stepinto.dev/posts/dotnet-to-go-iterators/</link><pubDate>Tue, 10 Nov 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-iterators/</guid><description>&lt;p&gt;The most common complaint in the comments on this series, and the first item in &lt;a href="https://stepinto.dev/posts/dotnet-to-go-what-i-miss/"&gt;what I miss from C#&lt;/a&gt;, is LINQ. That post shows this:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;activeUsers&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;u&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IsActive&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;OrderBy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;u&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Select&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;u&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ToList&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;and then the for loop and the &lt;code&gt;sort.Slice&lt;/code&gt; call you wrote instead. Go has had range-over-func iterators since 1.23, the standard library has been growing functions that return them in every release since, and Go 1.27 removed the one language restriction that made a fluent chain impossible. So this is the comparison that post hinted I ought to write at some point. I ran every snippet here on 1.27 before writing it up, and where .NET is better, or where I think Go is still missing something, I will point that out.&lt;/p&gt;</description></item><item><title>Clay in Clay</title><link>https://stepinto.dev/posts/clay-in-clay/</link><pubDate>Mon, 09 Nov 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/clay-in-clay/</guid><description>&lt;p&gt;I have been building a series of pages where the computer generates the pattern: &lt;a href="https://stepinto.dev/posts/tiles-painted-by-rule/"&gt;tin-glazed tiles painted by rule&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/cut-tile-and-poured-cement/"&gt;cut tile and poured cement&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/heraldry-by-rule/"&gt;heraldry&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/knotwork-by-rule/"&gt;knotwork&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/a-piece-that-breaks-another-piece/"&gt;a piece that breaks another piece&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/light-on-brick-paint-on-cream/"&gt;brick in raking light&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/the-seventeen-ways-a-wall-can-repeat/"&gt;the seventeen ways a wall can repeat&lt;/a&gt; and &lt;a href="https://stepinto.dev/posts/iron-and-silk/"&gt;iron and silk&lt;/a&gt;. We&amp;rsquo;ve been travelling round Europe, mostly round Spain, borrowing from the art and the history of each place. This one is from England, which has its own tile, made by pressing a pattern into one clay and filling it with another.&lt;/p&gt;</description></item><item><title>How a World Model Differs From an LLM, and Why You Want Both</title><link>https://stepinto.dev/posts/world-models-106/</link><pubDate>Mon, 09 Nov 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/world-models-106/</guid><description>&lt;p&gt;The &lt;a href="https://stepinto.dev/posts/world-models-104/"&gt;last post&lt;/a&gt; ended by saying the next one would put the heater model next to an LLM. This series has drawn that line twice already. The &lt;a href="https://stepinto.dev/posts/world-models-001/"&gt;first post&lt;/a&gt; said that if you ask a chatbot what happens when you turn the heater on, &amp;ldquo;you&amp;rsquo;ll get a fluent, plausible story about the room warming up&amp;rdquo;, and the &lt;a href="https://stepinto.dev/posts/world-models-101/"&gt;101 post&lt;/a&gt; put it in a table: for &amp;ldquo;what if?&amp;rdquo;, an LLM &amp;ldquo;narrates a plausible story&amp;rdquo; and a world model &amp;ldquo;rolls the trajectory forward&amp;rdquo;.&lt;/p&gt;</description></item><item><title>Iron and Silk</title><link>https://stepinto.dev/posts/iron-and-silk/</link><pubDate>Fri, 06 Nov 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/iron-and-silk/</guid><description>&lt;p&gt;I have been building a series of pages where the computer generates the pattern: &lt;a href="https://stepinto.dev/posts/tiles-painted-by-rule/"&gt;tin-glazed tiles painted by rule&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/cut-tile-and-poured-cement/"&gt;cut tile and poured cement&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/heraldry-by-rule/"&gt;heraldry&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/knotwork-by-rule/"&gt;knotwork&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/a-piece-that-breaks-another-piece/"&gt;a piece that breaks another piece&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/light-on-brick-paint-on-cream/"&gt;brick in raking light&lt;/a&gt; and, this morning, &lt;a href="https://stepinto.dev/posts/the-seventeen-ways-a-wall-can-repeat/"&gt;the seventeen ways a wall can repeat&lt;/a&gt;. The brick piece, Sebka, drew nothing in shadow. The wall had three heights, the sun was a direction, and every shadow was a level&amp;rsquo;s own outline moved along the sun&amp;rsquo;s slant. That rule turned out to have two more pieces in it, and they are about as different as two materials can be: wrought iron, which is all shadow, and embroidered silk, which is all shine.&lt;/p&gt;</description></item><item><title>Reading the AI Act One Article at a Time</title><link>https://stepinto.dev/posts/ai-law-on-fridays/</link><pubDate>Fri, 06 Nov 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/ai-law-on-fridays/</guid><description>&lt;p&gt;The two posts I wrote in February about building AI platforms under European law, &lt;a href="https://stepinto.dev/posts/compliance-as-code-two-europes/"&gt;compliance-as-code&lt;/a&gt; and &lt;a href="https://stepinto.dev/posts/fine-tuning-under-european-law/"&gt;fine-tuning&lt;/a&gt;, stop at the architecture. They say where the compliance layer sits and not much about what goes in it. The AI Act is written in clauses, and each clause ends up as something specific in the code: a field in a log, a state in the UI, a test in CI. Most of what I read about the Act is written for lawyers or for the board, and very little of it gets as far as a pull request.&lt;/p&gt;</description></item><item><title>The Seventeen Ways a Wall Can Repeat</title><link>https://stepinto.dev/posts/the-seventeen-ways-a-wall-can-repeat/</link><pubDate>Fri, 06 Nov 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/the-seventeen-ways-a-wall-can-repeat/</guid><description>&lt;p&gt;I have been building a series of pages where the computer generates the pattern: &lt;a href="https://stepinto.dev/posts/tiles-painted-by-rule/"&gt;tin-glazed tiles painted by rule&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/cut-tile-and-poured-cement/"&gt;cut tile and poured cement&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/heraldry-by-rule/"&gt;heraldry&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/knotwork-by-rule/"&gt;knotwork&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/a-piece-that-breaks-another-piece/"&gt;a piece that breaks another piece&lt;/a&gt;, and last time &lt;a href="https://stepinto.dev/posts/light-on-brick-paint-on-cream/"&gt;brick in raking light and Granada&amp;rsquo;s green and blue&lt;/a&gt;. The tile walls in that run all repeat the same way. A square design is laid four times, mirrored or turned, and the wall is that block over and over. It worked for every wall so far, and it is one of seventeen.&lt;/p&gt;</description></item><item><title>A Claude Client in One C# File, Compiled Ahead of Time</title><link>https://stepinto.dev/posts/claude-hot-path-csharp/</link><pubDate>Thu, 05 Nov 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/claude-hot-path-csharp/</guid><description>&lt;p&gt;Last week&amp;rsquo;s client was &lt;a href="https://stepinto.dev/posts/claude-hot-path-go/"&gt;Go&lt;/a&gt;: a 5.8 MB static binary that starts in under two milliseconds, which is a high bar for any language with HTTP in its standard library. This week it&amp;rsquo;s C#. .NET has had everything the spec needs in the box for a decade, and since .NET 8 it has had Native AOT, which compiles the whole program to a single native executable with no runtime to install. I wanted to know whether that gets a C# client anywhere near Go on size and cold start. It gets closer than I expected, though the runtime column on the leaderboard shows what the binary size leaves out.&lt;/p&gt;</description></item><item><title>Everything I Automated on This Blog</title><link>https://stepinto.dev/posts/everything-i-automated-on-this-blog/</link><pubDate>Wed, 04 Nov 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/everything-i-automated-on-this-blog/</guid><description>&lt;p&gt;Automating &lt;em&gt;everything&lt;/em&gt; is a lifestyle for me rather than a task I finish, and this blog is where it shows most. This site is a Hugo build pushed to Azure Static Web Apps from a GitHub Actions workflow. Over the past year the workflow and the templates have grown a handful of jobs that do the chores I used to do by hand after publishing a post. None of it is clever, and most of it is under a hundred lines, but each piece came with one gotcha that cost me an afternoon. Here they are, in the order a post meets them.&lt;/p&gt;</description></item><item><title>Light on Brick, Paint on Cream</title><link>https://stepinto.dev/posts/light-on-brick-paint-on-cream/</link><pubDate>Wed, 04 Nov 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/light-on-brick-paint-on-cream/</guid><description>&lt;blockquote&gt;&#10;&lt;p&gt;Then the light&amp;rsquo;s gone over the fence to someone else&amp;rsquo;s garden,&#10;And the flowers stand there in the blue, keeping the colour to themselves&lt;/p&gt;&#10;&lt;p&gt;&lt;cite&gt;&lt;a href="https://stepinto.dev/words/last-light.html"&gt;Last Light&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;p&gt;I&amp;rsquo;ve been building a series of pages where the computer generates the pattern: &lt;a href="https://stepinto.dev/posts/tiles-painted-by-rule/"&gt;tin-glazed tiles painted by rule&lt;/a&gt;, then &lt;a href="https://stepinto.dev/posts/cut-tile-and-poured-cement/"&gt;cut tile and poured cement&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/heraldry-by-rule/"&gt;heraldry&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/knotwork-by-rule/"&gt;knotwork&lt;/a&gt; and, last time, &lt;a href="https://stepinto.dev/posts/a-piece-that-breaks-another-piece/"&gt;a piece that breaks another piece&lt;/a&gt;. They&amp;rsquo;ve been travelling round Europe, borrowing from the art and the history of each place, and trying to capture something about how patterns repeat across the whole of the artistic world. These two are Andalusia again, Seville and Granada, and they sit at opposite ends of what a page can do with a pattern. &lt;a href="https://stepinto.dev/art/sebka.html"&gt;Sebka&lt;/a&gt; paints nothing and lights everything. &lt;a href="https://stepinto.dev/art/fajalauza.html"&gt;Fajalauza&lt;/a&gt; lights nothing and is all paint.&lt;/p&gt;</description></item><item><title>Forty-Eight Posts on Moving From C# to Go, in the Right Order</title><link>https://stepinto.dev/posts/dotnet-to-go-in-the-right-order/</link><pubDate>Tue, 03 Nov 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-in-the-right-order/</guid><description>&lt;p&gt;The C# to Go series is forty-eight posts long. It covers the move from twenty years of .NET to writing Go in production, from the first &lt;code&gt;go build&lt;/code&gt; through to a six month retrospective, and it is the most-read thing on this site by a distance.&lt;/p&gt;&#10;&lt;p&gt;It was written as a sequence, but most readers do not arrive at the start of it. They arrive from a search for &amp;ldquo;Go equivalent of IOptions&amp;rdquo; and land on the configuration post, with no signpost to the twenty posts that explain the vocabulary it uses. The series page lists everything by date, which is correct and unhelpful.&lt;/p&gt;</description></item><item><title>Latent State Is the Fields You Never Logged</title><link>https://stepinto.dev/posts/world-models-104/</link><pubDate>Mon, 02 Nov 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/world-models-104/</guid><description>&lt;p&gt;The &lt;a href="https://stepinto.dev/posts/world-models-103/"&gt;last post&lt;/a&gt; ended with a challenge. Four weights fitted from logs can learn a room, but give that room a door that opens and closes on a schedule the logger never records, and the best a linear model can do is average over the door.&lt;/p&gt;&#10;&lt;p&gt;The log has three columns: the room temperature, the outside temperature and whether the heater is on. When the door opens the room cools faster, and every row written while it is open looks like a row from a room that is simply worse at holding heat. The model sees the effect and never the cause, so fitting the same three columns harder gets it nowhere. What the log does still have is order. A room that was cooling steadily and then drops three degrees in one step has told you something, even if no column says what.&lt;/p&gt;</description></item><item><title>A Claude Client in One Go File</title><link>https://stepinto.dev/posts/claude-hot-path-go/</link><pubDate>Thu, 29 Oct 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/claude-hot-path-go/</guid><description>&lt;p&gt;Last week I wrote a Claude client in &lt;a href="https://stepinto.dev/posts/claude-hot-path-bash/"&gt;bash&lt;/a&gt;, parsed the stream with regular expressions, and pinned it as the thing to beat. This week it&amp;rsquo;s Go, which has it rather easy by comparison.&lt;/p&gt;&#10;&lt;p&gt;Go is the first language in the series where the standard library covers everything the spec asks for: an HTTP client with TLS, a JSON codec, a buffered line reader, and a timezone database baked into the binary. The whole client is 175 lines in one file, and it runs from a &lt;code&gt;scratch&lt;/code&gt; image.&lt;/p&gt;</description></item><item><title>A Piece That Breaks Another Piece</title><link>https://stepinto.dev/posts/a-piece-that-breaks-another-piece/</link><pubDate>Thu, 29 Oct 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/a-piece-that-breaks-another-piece/</guid><description>&lt;blockquote&gt;&#10;&lt;p&gt;It was all broken by me really, or built like a clumsy caveman&lt;/p&gt;&#10;&lt;p&gt;&lt;cite&gt;&lt;a href="https://stepinto.dev/words/trying-to-have-something-right-afterwards.html"&gt;Trying to have something right afterwards&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;p&gt;I&amp;rsquo;ve been building a series of pages where the computer generates the pattern: &lt;a href="https://stepinto.dev/posts/tiles-painted-by-rule/"&gt;tin-glazed tiles painted by rule&lt;/a&gt;, then &lt;a href="https://stepinto.dev/posts/cut-tile-and-poured-cement/"&gt;cut tile and poured cement&lt;/a&gt;, then &lt;a href="https://stepinto.dev/posts/heraldry-by-rule/"&gt;heraldry&lt;/a&gt; and &lt;a href="https://stepinto.dev/posts/knotwork-by-rule/"&gt;knotwork&lt;/a&gt;. They&amp;rsquo;ve been travelling round Europe, borrowing from the art and the history of each place, and trying to capture something about how patterns repeat across the whole of the artistic world: the same rule turning up in a different material somewhere else. This one is Barcelona. I&amp;rsquo;ve stood in front of Casa Batlló, and walked a good deal of that city in Gaudí&amp;rsquo;s footprints, and the thing you notice about his surfaces once you&amp;rsquo;re close is that none of them are made of anything whole. The bench at Park Güell, the dragon on the stair below it, the chimneys on the Pedrera roof and the pinnacles of the Sagrada Família are all trencadís: tiles that somebody broke with a hammer and set back, shard by shard, in lime.&lt;/p&gt;</description></item><item><title>Where AI Research Actually Happens, in Six Charts</title><link>https://stepinto.dev/posts/where-ai-research-happens/</link><pubDate>Wed, 28 Oct 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/where-ai-research-happens/</guid><description>&lt;p&gt;&lt;a href="https://stepinto.dev/posts/compute-isnt-the-constraint/"&gt;Compute Isn&amp;rsquo;t the Constraint&lt;/a&gt; argued that the UK&amp;rsquo;s sovereign AI fund is buying the wrong input. That post was prose. This one is the numbers behind it, drawn so you can check them, with the source data under every chart as CSV. The sources are at the end.&lt;/p&gt;&#10;&lt;h2 id="who-publishes" id="who-publishes"&gt;Who publishes&lt;a href="#who-publishes" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&#10;&lt;figure class="chart"&gt;&#10; &lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 360" width="720" height="360" role="img" aria-labelledby="t d" font-family="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif" style="max-width:100%;height:auto;display:block"&gt;&lt;title id="t"&gt;Share of global AI publications, 2000 to 2025&lt;/title&gt;&lt;desc id="d"&gt;Three lines. China rises from 5% to 36%. The EU falls from 30% to 12%. The US falls from 28% to 12%.&lt;/desc&gt;&lt;rect width="720" height="360" fill="#0d1117"/&gt;&lt;line x1="48" y1="312.0" x2="570" y2="312.0" stroke="#1c2430" stroke-width="1"/&gt;&lt;text x="40.0" y="316.0" font-size="11" fill="#6f7a8c" text-anchor="end" font-weight="400" &gt;0%&lt;/text&gt;&lt;line x1="48" y1="241.0" x2="570" y2="241.0" stroke="#1c2430" stroke-width="1"/&gt;&lt;text x="40.0" y="245.0" font-size="11" fill="#6f7a8c" text-anchor="end" font-weight="400" &gt;10%&lt;/text&gt;&lt;line x1="48" y1="170.0" x2="570" y2="170.0" stroke="#1c2430" stroke-width="1"/&gt;&lt;text x="40.0" y="174.0" font-size="11" fill="#6f7a8c" text-anchor="end" font-weight="400" &gt;20%&lt;/text&gt;&lt;line x1="48" y1="99.0" x2="570" y2="99.0" stroke="#1c2430" stroke-width="1"/&gt;&lt;text x="40.0" y="103.0" font-size="11" fill="#6f7a8c" text-anchor="end" font-weight="400" &gt;30%&lt;/text&gt;&lt;line x1="48" y1="28.0" x2="570" y2="28.0" stroke="#1c2430" stroke-width="1"/&gt;&lt;text x="40.0" y="32.0" font-size="11" fill="#6f7a8c" text-anchor="end" font-weight="400" &gt;40%&lt;/text&gt;&lt;text x="48.0" y="332.0" font-size="11" fill="#6f7a8c" text-anchor="middle" font-weight="400" &gt;2000&lt;/text&gt;&lt;text x="152.4" y="332.0" font-size="11" fill="#6f7a8c" text-anchor="middle" font-weight="400" &gt;2005&lt;/text&gt;&lt;text x="256.8" y="332.0" font-size="11" fill="#6f7a8c" text-anchor="middle" font-weight="400" &gt;2010&lt;/text&gt;&lt;text x="361.2" y="332.0" font-size="11" fill="#6f7a8c" text-anchor="middle" font-weight="400" &gt;2015&lt;/text&gt;&lt;text x="465.6" y="332.0" font-size="11" fill="#6f7a8c" text-anchor="middle" font-weight="400" &gt;2020&lt;/text&gt;&lt;text x="570.0" y="332.0" font-size="11" fill="#6f7a8c" text-anchor="middle" font-weight="400" &gt;2025&lt;/text&gt;&lt;line x1="48" y1="312.0" x2="570" y2="312.0" stroke="#2c3542" stroke-width="1"/&gt;&lt;polyline points="48.0,277.2 152.4,182.1 256.8,108.5 361.2,191.2 465.6,165.5 570.0,57.0" fill="none" stroke="#3987e5" stroke-width="2" stroke-linejoin="round" stroke-linecap="round"/&gt;&lt;circle cx="48.0" cy="277.2" r="4" fill="#3987e5" stroke="#0d1117" stroke-width="2"&gt;&lt;title&gt;China, 2000: 4.9%&lt;/title&gt;&lt;/circle&gt;&lt;circle cx="152.4" cy="182.1" r="4" fill="#3987e5" stroke="#0d1117" stroke-width="2"&gt;&lt;title&gt;China, 2005: 18.3%&lt;/title&gt;&lt;/circle&gt;&lt;circle cx="256.8" cy="108.5" r="4" fill="#3987e5" stroke="#0d1117" stroke-width="2"&gt;&lt;title&gt;China, 2010: 28.7%&lt;/title&gt;&lt;/circle&gt;&lt;circle cx="361.2" cy="191.2" r="4" fill="#3987e5" stroke="#0d1117" stroke-width="2"&gt;&lt;title&gt;China, 2015: 17.0%&lt;/title&gt;&lt;/circle&gt;&lt;circle cx="465.6" cy="165.5" r="4" fill="#3987e5" stroke="#0d1117" stroke-width="2"&gt;&lt;title&gt;China, 2020: 20.6%&lt;/title&gt;&lt;/circle&gt;&lt;circle cx="570.0" cy="57.0" r="4" fill="#3987e5" stroke="#0d1117" stroke-width="2"&gt;&lt;title&gt;China, 2025: 35.9%&lt;/title&gt;&lt;/circle&gt;&lt;polyline points="48.0,102.3 152.4,153.9 256.8,148.6 361.2,147.1 465.6,189.5 570.0,224.0" fill="none" stroke="#d95926" stroke-width="2" stroke-linejoin="round" stroke-linecap="round"/&gt;&lt;circle cx="48.0" cy="102.3" r="4" fill="#d95926" stroke="#0d1117" stroke-width="2"&gt;&lt;title&gt;EU27, 2000: 29.5%&lt;/title&gt;&lt;/circle&gt;&lt;circle cx="152.4" cy="153.9" r="4" fill="#d95926" stroke="#0d1117" stroke-width="2"&gt;&lt;title&gt;EU27, 2005: 22.3%&lt;/title&gt;&lt;/circle&gt;&lt;circle cx="256.8" cy="148.6" r="4" fill="#d95926" stroke="#0d1117" stroke-width="2"&gt;&lt;title&gt;EU27, 2010: 23.0%&lt;/title&gt;&lt;/circle&gt;&lt;circle cx="361.2" cy="147.1" r="4" fill="#d95926" stroke="#0d1117" stroke-width="2"&gt;&lt;title&gt;EU27, 2015: 23.2%&lt;/title&gt;&lt;/circle&gt;&lt;circle cx="465.6" cy="189.5" r="4" fill="#d95926" stroke="#0d1117" stroke-width="2"&gt;&lt;title&gt;EU27, 2020: 17.3%&lt;/title&gt;&lt;/circle&gt;&lt;circle cx="570.0" cy="224.0" r="4" fill="#d95926" stroke="#0d1117" stroke-width="2"&gt;&lt;title&gt;EU27, 2025: 12.4%&lt;/title&gt;&lt;/circle&gt;&lt;polyline points="48.0,116.3 152.4,149.3 256.8,205.9 361.2,201.2 465.6,180.8 570.0,226.7" fill="none" stroke="#199e70" stroke-width="2" stroke-linejoin="round" stroke-linecap="round"/&gt;&lt;circle cx="48.0" cy="116.3" r="4" fill="#199e70" stroke="#0d1117" stroke-width="2"&gt;&lt;title&gt;United States, 2000: 27.6%&lt;/title&gt;&lt;/circle&gt;&lt;circle cx="152.4" cy="149.3" r="4" fill="#199e70" stroke="#0d1117" stroke-width="2"&gt;&lt;title&gt;United States, 2005: 22.9%&lt;/title&gt;&lt;/circle&gt;&lt;circle cx="256.8" cy="205.9" r="4" fill="#199e70" stroke="#0d1117" stroke-width="2"&gt;&lt;title&gt;United States, 2010: 14.9%&lt;/title&gt;&lt;/circle&gt;&lt;circle cx="361.2" cy="201.2" r="4" fill="#199e70" stroke="#0d1117" stroke-width="2"&gt;&lt;title&gt;United States, 2015: 15.6%&lt;/title&gt;&lt;/circle&gt;&lt;circle cx="465.6" cy="180.8" r="4" fill="#199e70" stroke="#0d1117" stroke-width="2"&gt;&lt;title&gt;United States, 2020: 18.5%&lt;/title&gt;&lt;/circle&gt;&lt;circle cx="570.0" cy="226.7" r="4" fill="#199e70" stroke="#0d1117" stroke-width="2"&gt;&lt;title&gt;United States, 2025: 12.0%&lt;/title&gt;&lt;/circle&gt;&lt;text x="580.0" y="61.0" font-size="12" fill="#e4e9f2" text-anchor="start" font-weight="600" &gt;China 35.9%&lt;/text&gt;&lt;line x1="574.0" y1="224.0" x2="584.0" y2="211.0" stroke="#2c3542" stroke-width="1"/&gt;&lt;line x1="574.0" y1="226.7" x2="584.0" y2="235.7" stroke="#2c3542" stroke-width="1"/&gt;&lt;text x="586.0" y="214.0" font-size="12" fill="#e4e9f2" text-anchor="start" font-weight="600" &gt;EU27 12.4%&lt;/text&gt;&lt;text x="586.0" y="238.7" font-size="12" fill="#e4e9f2" text-anchor="start" font-weight="600" &gt;US 12.0%&lt;/text&gt;&lt;rect x="48" y="5" width="12" height="12" rx="2" fill="#3987e5"/&gt;&lt;text x="66.0" y="15.0" font-size="12" fill="#a7b0c0" text-anchor="start" font-weight="400" &gt;China&lt;/text&gt;&lt;rect x="125" y="5" width="12" height="12" rx="2" fill="#d95926"/&gt;&lt;text x="143.0" y="15.0" font-size="12" fill="#a7b0c0" text-anchor="start" font-weight="400" &gt;EU27&lt;/text&gt;&lt;rect x="195" y="5" width="12" height="12" rx="2" fill="#199e70"/&gt;&lt;text x="213.0" y="15.0" font-size="12" fill="#a7b0c0" text-anchor="start" font-weight="400" &gt;United States&lt;/text&gt;&lt;/svg&gt;&#10;&#10; &lt;figcaption&gt;&lt;span class="chart-caption"&gt;Share of global AI publications by fractional count, OpenAlex via OECD.AI. China&amp;rsquo;s dip between 2010 and 2015 is in the source data.&lt;/span&gt;&#10; &lt;a class="chart-data" href="https://stepinto.dev/data/research-publications.csv" download&gt;Download the data (CSV)&lt;/a&gt;&#10; &lt;/figcaption&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;p&gt;The United States and the EU together produced over half of the world&amp;rsquo;s AI papers in 2000. They produce under a quarter now. Volume moved east and it is not coming back.&lt;/p&gt;</description></item><item><title>Knotwork by Rule</title><link>https://stepinto.dev/posts/knotwork-by-rule/</link><pubDate>Sun, 25 Oct 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/knotwork-by-rule/</guid><description>&lt;blockquote&gt;&#10;&lt;p&gt;All the plans turn into old tickets, half unredeemed.&lt;/p&gt;&#10;&lt;p&gt;&lt;cite&gt;&lt;a href="https://stepinto.dev/words/old-tickets.html"&gt;Old Tickets&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;p&gt;The series has been working its way north. Andalusian tile, then English heraldry, then a medieval English floor, and now the furthest north it&amp;rsquo;s going to get: the carpet pages of the Lindisfarne Gospels, the Book of Durrow and the Book of Kells. Whole pages of vellum given over to ribbons that go over, under, over, under, round every corner and back, in red lead, orpiment yellow and verdigris green, with the odd dog&amp;rsquo;s head biting its own tail.&lt;/p&gt;</description></item><item><title>A Partial JSON Parser You Can npm install</title><link>https://stepinto.dev/posts/partial-json-parser-npm/</link><pubDate>Sat, 24 Oct 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/partial-json-parser-npm/</guid><description>&lt;p&gt;Two years ago I wrote &lt;a href="https://stepinto.dev/posts/streaming-json-partial-parser/"&gt;a partial JSON parser&lt;/a&gt; for one job: pulling the &lt;code&gt;response&lt;/code&gt; field out of a half-received LLM reply so the text could appear on screen while the rest of the JSON was still streaming. The post ended with a ninety-line function in a code block and a gist to copy. The streaming post that followed it leaned on the same function, and each app I used it in got its own copy with the field name changed, which is the sign that a code block should have been a package.&lt;/p&gt;</description></item><item><title>Heraldry by Rule</title><link>https://stepinto.dev/posts/heraldry-by-rule/</link><pubDate>Sat, 24 Oct 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/heraldry-by-rule/</guid><description>&lt;blockquote&gt;&#10;&lt;p&gt;The man who boarded at Gatwick never got off in Seville.&lt;/p&gt;&#10;&lt;p&gt;&lt;cite&gt;&lt;a href="https://stepinto.dev/words/teleporter.html"&gt;Teleporter&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;p&gt;Until now the art pages have stayed on the peninsula: Islamic stars, Talavera cobalt, the Alhambra&amp;rsquo;s cut tile, Barcelona&amp;rsquo;s cement floors, Roman pavements under Seville. I&amp;rsquo;m English, and I wanted the series to come home without changing the subject. The link turns out to be seven hundred years old and made of exactly the right stuff. Eleanor of Castile married Edward I in 1254 and brought her arms with her, the castle of Castile quartered with the lion of León. They&amp;rsquo;re carved on her tomb in Westminster Abbey and on the crosses Edward put up wherever her coffin rested on the way to London. Two centuries later Catherine of Aragon&amp;rsquo;s badge, the pomegranate of Granada beside the Tudor rose, got carved and painted over half of Tudor England. Heraldry is how Spain got into English stone, so heraldry is how England gets into this series.&lt;/p&gt;</description></item><item><title>Cut Tile and Poured Cement</title><link>https://stepinto.dev/posts/cut-tile-and-poured-cement/</link><pubDate>Fri, 23 Oct 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/cut-tile-and-poured-cement/</guid><description>&lt;blockquote&gt;&#10;&lt;p&gt;It was all broken by me really, or built like a clumsy caveman&lt;/p&gt;&#10;&lt;p&gt;&lt;cite&gt;&lt;a href="https://stepinto.dev/words/trying-to-have-something-right-afterwards.html"&gt;Trying to have something right afterwards&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;p&gt;The two tile walls I wrote up &lt;a href="https://stepinto.dev/posts/tiles-painted-by-rule/"&gt;last time&lt;/a&gt; are painted: a brush drifts, a wash pools, an ink line goes on top. These two aren&amp;rsquo;t painted at all. &lt;a href="https://stepinto.dev/art/alicatado.html"&gt;Alicatado&lt;/a&gt; is cut: every piece is chipped out of a fired, glazed tile with a hammer and bedded in lime next to its neighbours, the way the dados of the Alhambra were made. &lt;a href="https://stepinto.dev/art/hidraulico.html"&gt;Hidráulico&lt;/a&gt; is pressed: pigmented cement poured into a brass divider, lifted, pressed and left to cure, never fired, the way every hallway in Spain was floored between 1880 and 1960.&lt;/p&gt;</description></item><item><title>The Hot Path to Claude Is a Shell Script</title><link>https://stepinto.dev/posts/claude-hot-path-bash/</link><pubDate>Thu, 22 Oct 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/claude-hot-path-bash/</guid><description>&lt;p&gt;The hot path to Claude is one HTTPS POST and a stream of six event types. Every SDK wraps that in thousands of lines, and the wrapping costs you: in cold start, in memory, and in the milliseconds between the model finishing a thought and your code acting on it. For a chat window none of that matters. For a CLI that should feel instant, a Lambda that is billed from the first millisecond, or an agent loop making ten thousand calls a day, it is the only part of the latency you control.&lt;/p&gt;</description></item><item><title>Tiles Painted by Rule</title><link>https://stepinto.dev/posts/tiles-painted-by-rule/</link><pubDate>Thu, 22 Oct 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/tiles-painted-by-rule/</guid><description>&lt;blockquote&gt;&#10;&lt;p&gt;The roses and white lilies, their petals curl and tap the azulejería,&#10;The sounds of a future unrealised.&lt;/p&gt;&#10;&lt;p&gt;&lt;cite&gt;&lt;a href="https://stepinto.dev/words/sounds-of-a-future-unrealised.html"&gt;Sounds of a Future Unrealised&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;p&gt;Two of the art pages here are walls of tin-glazed tiles. &lt;a href="https://stepinto.dev/art/azulejeria.html"&gt;Azulejería&lt;/a&gt; is the cobalt rosette of a Talavera dado and the strapwork of a Seville patio. &lt;a href="https://stepinto.dev/art/jerez.html"&gt;Jerez&lt;/a&gt; is the same wall sent south: grapes and vine leaves, horses&amp;rsquo; heads, a sherry glass sitting across every join. Neither page has a picture in it. Each grows a design from a seed and paints it the way a brush would, then keeps repeating it until the screen is full.&lt;/p&gt;</description></item><item><title>The Danger of a Hidden Sun</title><link>https://stepinto.dev/posts/the-danger-of-a-hidden-sun/</link><pubDate>Tue, 20 Oct 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/the-danger-of-a-hidden-sun/</guid><description>&lt;p&gt;I spent a weekend trying to make a 3D scene look less flat and ended up making it faster instead. The flatness and the frame drops turned out to be the same bug, viewed from opposite sides.&lt;/p&gt;&#10;&lt;p&gt;I was helping out a friend on their app. The scene is a few hundred small buildings on a flat ground plane, rendered with &lt;a href="https://github.com/google/filament"&gt;Filament&lt;/a&gt; through react-native-filament, running on whatever phone the user happens to own. It has a performance budget system with tiers, and the lower tiers get simplified meshes, fewer decorations and smaller render arenas. It is the kind of app where you count draw calls.&lt;/p&gt;</description></item><item><title>Learning the Heater From Its Own Logs</title><link>https://stepinto.dev/posts/world-models-103/</link><pubDate>Mon, 19 Oct 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/world-models-103/</guid><description>&lt;p&gt;The &lt;a href="https://stepinto.dev/posts/world-models-101/"&gt;first code post&lt;/a&gt; in this series had a &lt;code&gt;predict&lt;/code&gt; function whose body I typed by hand. Heat leaks towards outside at a tenth of the difference per step, the heater adds a degree and a half, and I made both of those numbers up. That was fine for showing the shape of a world model. It is useless for a real room, because a real room does not tell you its constants. What it gives you instead is a log.&lt;/p&gt;</description></item><item><title>The World Model Equation Is a WHERE Clause</title><link>https://stepinto.dev/posts/world-models-102/</link><pubDate>Tue, 07 Jul 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/world-models-102/</guid><description>&lt;p&gt;The &lt;a href="https://stepinto.dev/posts/world-models-101/"&gt;first code post&lt;/a&gt; in this series opened with a jab at explanations that lead with &amp;ldquo;a conditional probability, a subscript, a latent variable, and half the audience gone by paragraph three&amp;rdquo;. I also promised the maths would eventually arrive, once it described something you&amp;rsquo;d already watched run. This post makes good on that: it takes exactly those three scary things, one at a time, and shows that you&amp;rsquo;ve been writing all of them in TypeScript for years under different names.&lt;/p&gt;</description></item><item><title>A World Model in Forty Lines of TypeScript</title><link>https://stepinto.dev/posts/world-models-101/</link><pubDate>Mon, 06 Jul 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/world-models-101/</guid><description>&lt;p&gt;Every explanation of world models I&amp;rsquo;ve read starts the same way. A conditional probability, a subscript, a latent variable, and half the audience gone by paragraph three. Which is a shame, because the core idea fits in a few lines of code and most working programmers already have the intuition. They&amp;rsquo;ve just never had it pointed at.&lt;/p&gt;&#10;&lt;p&gt;So this series starts with TypeScript. We&amp;rsquo;ll get to the equations eventually, but only once they&amp;rsquo;re describing something you&amp;rsquo;ve already watched run. (If you&amp;rsquo;d rather have today&amp;rsquo;s ideas with no code at all, the &lt;a href="https://stepinto.dev/posts/world-models-001/"&gt;previous post&lt;/a&gt; covers the same ground in prose.)&lt;/p&gt;</description></item><item><title>Your Time Series Is Already Training Data</title><link>https://stepinto.dev/posts/world-models-001/</link><pubDate>Sun, 05 Jul 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/world-models-001/</guid><description>&lt;p&gt;At &lt;a href="https://getunimo.com"&gt;Unimo&lt;/a&gt; we spend our days watching telemetry from energy hardware. Temperatures, states of charge, power flows, a reading every few seconds from devices sitting in buildings we&amp;rsquo;ll never visit. Alongside the readings sits a second stream that gets far less attention: the commands. Turn this on. Back that off. Hold here.&lt;/p&gt;&#10;&lt;p&gt;For years I thought of those two streams as operations data. You keep them so you can draw dashboards, catch faults, and win arguments about what actually happened last Tuesday. Then I started reading about world models, and it slowly dawned on me that we&amp;rsquo;d been sitting on something else entirely. Interleave the two streams and you get a long record of &lt;em&gt;the world was like this, we did that, and here is what happened next&lt;/em&gt;. That record is exactly what a world model is trained on. We hadn&amp;rsquo;t been keeping logs. We&amp;rsquo;d been keeping lessons.&lt;/p&gt;</description></item><item><title>Compute Isn't the Constraint</title><link>https://stepinto.dev/posts/compute-isnt-the-constraint/</link><pubDate>Wed, 17 Jun 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/compute-isnt-the-constraint/</guid><description>&lt;p&gt;After &lt;a href="https://stepinto.dev/posts/when-the-api-gets-switched-off/"&gt;When the API Gets Switched Off&lt;/a&gt; went up, Bram De Buyser, an old friend, wrote back and put his finger on a line of thought I&amp;rsquo;d neglected. The frontier-lab ambition got one paragraph and a vague nod to &amp;ldquo;a serious compute commitment&amp;rdquo;, and that nod is where the strategy is thinnest. His point, roughly:&lt;/p&gt;&#10;&lt;blockquote&gt;&#10;&lt;p&gt;The Sovereign AI fund is primarily about compute access, but labs like Anthropic, OpenAI and Mistral aren&amp;rsquo;t pumping out better models just because of compute access. They&amp;rsquo;re putting in core research the others don&amp;rsquo;t have yet, and that requires research staff and experimenting, not just training or inference compute. If the UK wants to compete on the frontier, it needs to come up with the actual frontier, not just train models based on papers from 2022 that the big labs already consider obsolete.&lt;/p&gt;&#10;&lt;/blockquote&gt;</description></item><item><title>When the API Gets Switched Off</title><link>https://stepinto.dev/posts/when-the-api-gets-switched-off/</link><pubDate>Sun, 14 Jun 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/when-the-api-gets-switched-off/</guid><description>&lt;p&gt;On 13 June, Anthropic disabled Claude Fable 5 and Mythos 5 for every customer outside the United States. Not deprecated, not rate-limited, but disabled. US national security authorities raised concerns days after the public release, and the company wrote that &amp;ldquo;the net effect of this order is that we must abruptly disable Fable 5 and Mythos 5 for all our customers to ensure compliance.&amp;rdquo;&lt;/p&gt;&#10;&lt;p&gt;Fable 5 was only generally available for about three days before it got pulled, so it&amp;rsquo;s not as though it was load-bearing in anyone&amp;rsquo;s production stack. It was available in mine, in CrossMoore EngineCore, but sitting there as a capability while we learned how it behaved, not running anything that mattered. The shape of it is what counts though. No migration window, no deprecation notice. One evening the calls just came back as an error.&lt;/p&gt;</description></item><item><title>Streaming AI Responses from Server to Screen</title><link>https://stepinto.dev/posts/streaming-structured-responses/</link><pubDate>Mon, 23 Mar 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/streaming-structured-responses/</guid><description>&lt;p&gt;I wrote previously about &lt;a href="https://stepinto.dev/posts/streaming-json-partial-parser/"&gt;a partial JSON parser&lt;/a&gt; for extracting text from incomplete LLM responses as they stream in. That post covered one specific piece: pulling the &lt;code&gt;response&lt;/code&gt; field out of a half-received JSON object so users see text immediately.&lt;/p&gt;&#10;&lt;p&gt;But that parser lives inside a larger system. There&amp;rsquo;s a server emitting tokens over SSE, a chunk protocol that handles tool execution mid-response, a transport layer that works on React Native (barely), and a rendering pipeline that switches from plain text to rich content when the stream completes. The parser was the fun bit to write about. The pipeline around it is where the real engineering decisions live.&lt;/p&gt;</description></item><item><title>What It Actually Takes to Fine-Tune an LLM in Europe</title><link>https://stepinto.dev/posts/fine-tuning-under-european-law/</link><pubDate>Fri, 13 Feb 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/fine-tuning-under-european-law/</guid><description>&lt;p&gt;This series has so far dealt with deployment. &lt;a href="https://stepinto.dev/posts/european-ai-sovereignty/"&gt;Where to host models&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/compliance-as-code-two-europes/"&gt;how to wrap them in compliance logic&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/sovereign-inference-stack/"&gt;which providers can serve inference&lt;/a&gt;, and &lt;a href="https://stepinto.dev/posts/securing-open-source-ai-supply-chain/"&gt;how to verify the supply chain&lt;/a&gt;. All of that assumes you already have a model worth deploying.&lt;/p&gt;&#10;&lt;p&gt;This post goes earlier in the pipeline. What happens when you want to fine-tune a foundation model on proprietary data, and you need that model to be legal in both the UK and the EU?&lt;/p&gt;</description></item><item><title>Securing the Open Source AI Supply Chain</title><link>https://stepinto.dev/posts/securing-open-source-ai-supply-chain/</link><pubDate>Wed, 11 Feb 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/securing-open-source-ai-supply-chain/</guid><description>&lt;p&gt;This is the fourth post in a series on European AI sovereignty. I have covered &lt;a href="https://stepinto.dev/posts/european-ai-sovereignty/"&gt;why jurisdiction matters&lt;/a&gt;, &lt;a href="https://stepinto.dev/posts/compliance-as-code-two-europes/"&gt;how to handle UK-EU regulatory divergence in code&lt;/a&gt;, and &lt;a href="https://stepinto.dev/posts/sovereign-inference-stack/"&gt;a practical guide to the sovereign inference stack&lt;/a&gt;. Those posts treated the open-source AI toolchain as a given. PyTorch, Llama, vLLM, Hugging Face. Just pick your models and deploy.&lt;/p&gt;&#10;&lt;p&gt;This post asks a harder question: what happens when the toolchain itself is the threat?&lt;/p&gt;&#10;&lt;p&gt;Open-source frameworks like PyTorch and open-weight models like Llama have democratised access to frontier-level AI. That is genuinely remarkable. But they have also introduced a web of dependencies that is susceptible to supply chain attacks, adversarial manipulation, and geopolitical pressure. The &lt;a href="https://www.ncsc.gov.uk/blog-post/machine-learning-security-principles-updated"&gt;NCSC&lt;/a&gt;, &lt;a href="https://www.enisa.europa.eu/topics/cyber-threats/threat-landscape"&gt;ENISA&lt;/a&gt;, and the &lt;a href="https://www.cyber.gov.au/business-government/secure-design/artificial-intelligence/artificial-intelligence-and-machine-learning-supply-chain-risks-and-mitigations"&gt;Australian Cyber Security Centre&lt;/a&gt; have all published guidance on this. The supply chain problem is not a glitch to be patched. It is a structural vulnerability that touches critical infrastructure, from energy grids to healthcare systems.&lt;/p&gt;</description></item><item><title>A Practical Guide to the European Sovereign Inference Stack</title><link>https://stepinto.dev/posts/sovereign-inference-stack/</link><pubDate>Mon, 09 Feb 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/sovereign-inference-stack/</guid><description>&lt;p&gt;I wrote previously about &lt;a href="https://stepinto.dev/posts/european-ai-sovereignty/"&gt;why jurisdiction matters for European AI platforms&lt;/a&gt; and then about &lt;a href="https://stepinto.dev/posts/compliance-as-code-two-europes/"&gt;how to handle the UK-EU compliance split in code&lt;/a&gt;. Those posts covered the &amp;ldquo;why&amp;rdquo; and the regulatory &amp;ldquo;how.&amp;rdquo; This one covers the practical &amp;ldquo;how.&amp;rdquo; If you want to move away from the Big Three (AWS, GCP, Azure), whether to mitigate political risk because you distrust their sovereign cloud offerings, or to comply with &lt;a href="https://www.europarl.europa.eu/doceo/document/TA-9-2021-0026_EN.html"&gt;Schrems II&lt;/a&gt; (the 2020 CJEU ruling that invalidated the EU-US Privacy Shield), you are entering the world of the European sovereign inference stack.&lt;/p&gt;</description></item><item><title>Architecting for Two Europes with Compliance-as-Code</title><link>https://stepinto.dev/posts/compliance-as-code-two-europes/</link><pubDate>Sun, 08 Feb 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/compliance-as-code-two-europes/</guid><description>&lt;p&gt;I wrote recently about &lt;a href="https://stepinto.dev/posts/european-ai-sovereignty/"&gt;building AI platforms under European sovereignty constraints&lt;/a&gt;. That post treated &amp;ldquo;Europe&amp;rdquo; as broadly singular. The reality is messier.&lt;/p&gt;&#10;&lt;p&gt;Arguably, there was never a single Digital Single Market for AI. The technology went mainstream after Brexit. From a British perspective, there were always two Europes. From a European one, there was the single market and then a small market that broke off. Either way, you are building for two regulatory surfaces now.&lt;/p&gt;</description></item><item><title>Building AI Platforms Under European Sovereignty</title><link>https://stepinto.dev/posts/european-ai-sovereignty/</link><pubDate>Tue, 03 Feb 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/european-ai-sovereignty/</guid><description>&lt;h2 id="the-problem-is-not-capability" id="the-problem-is-not-capability"&gt;The Problem Is Not Capability&lt;a href="#the-problem-is-not-capability" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;Most conversations about European AI start with benchmarks: parameter counts, the gap between Mistral and GPT-4, how far behind Europe is on raw capability. It&amp;rsquo;s the wrong starting point. The primary constraint isn&amp;rsquo;t capability. Europe isn&amp;rsquo;t simply losing a race it could win if it spent more. The constraint is jurisdiction.&lt;/p&gt;&#10;&lt;p&gt;Modern AI is no longer just models. The supply chain matters, the control plane matters, the update path matters. So does the legal exposure: who can compel disclosure, who can silently modify weights, who controls the keys to your fine-tuned checkpoints, whether your inference logs could become evidence in a foreign court. When you call an American API, you are not merely renting compute. You are subjecting your data, your users, and your organisation to a legal regime you do not control and cannot predict.&lt;/p&gt;</description></item><item><title>There Are No Emotions in Runtime Software</title><link>https://stepinto.dev/posts/no-emotions-in-runtime/</link><pubDate>Tue, 13 Jan 2026 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/no-emotions-in-runtime/</guid><description>&lt;p&gt;I read a piece this morning arguing that you shouldn&amp;rsquo;t trust software you didn&amp;rsquo;t &amp;ldquo;suffer&amp;rdquo; for. The premise being that personal struggle (the late nights, the debugging sessions, the moments of quiet desperation) somehow imbues code with trustworthiness. That suffering is the price of admission to understanding.&lt;/p&gt;&#10;&lt;p&gt;It&amp;rsquo;s a romantic notion. I understand the appeal. But it&amp;rsquo;s also, I think, deeply wrong.&lt;/p&gt;&#10;&lt;h2 id="suffering-is-not-a-unit-of-measurement" id="suffering-is-not-a-unit-of-measurement"&gt;Suffering Is Not a Unit of Measurement&lt;a href="#suffering-is-not-a-unit-of-measurement" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;Suffering is wildly subjective. What destroys one developer is another&amp;rsquo;s Tuesday afternoon. I&amp;rsquo;ve watched juniors spend three days on something I could solve in an hour. Not because I&amp;rsquo;m smarter, but because I&amp;rsquo;ve already suffered through that particular flavour of hell a decade ago. Does their code become more trustworthy because they bled for it? Does mine become suspect because it didn&amp;rsquo;t cost me enough?&lt;/p&gt;</description></item><item><title>Six Months In: Was It Worth It?</title><link>https://stepinto.dev/posts/dotnet-to-go-six-months/</link><pubDate>Sat, 28 Jun 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-six-months/</guid><description>&lt;p&gt;Six months ago, I started this series with a simple goal: document learning Go as an experienced C# developer. Not a tutorial (there are plenty of those) but an honest account of the transition.&lt;/p&gt;&#10;&lt;p&gt;Now, with half a year of production Go code behind me, it&amp;rsquo;s time for a retrospective. Was it worth it? Would I do it again? What would I tell past-me?&lt;/p&gt;&#10;&lt;h2 id="the-learning-curve" id="the-learning-curve"&gt;The Learning Curve&lt;a href="#the-learning-curve" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;&lt;strong&gt;Weeks 1-2&lt;/strong&gt;: Syntax adjustment. Easy. Go is a small language.&lt;/p&gt;</description></item><item><title>What I'll Never Go Back For</title><link>https://stepinto.dev/posts/dotnet-to-go-never-go-back/</link><pubDate>Sat, 01 Feb 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-never-go-back/</guid><description>&lt;p&gt;Last time I talked about what I miss from C#. Now let&amp;rsquo;s flip it: what has Go given me that I&amp;rsquo;d properly struggle to give up?&lt;/p&gt;&#10;&lt;p&gt;Some of these I expected to like. Others surprised me. All of them have changed how I think about software.&lt;/p&gt;&#10;&lt;h2 id="fast-compilation" id="fast-compilation"&gt;Fast Compilation&lt;a href="#fast-compilation" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;This sounds minor until you&amp;rsquo;ve lived it. &lt;code&gt;go build&lt;/code&gt; takes seconds. For a large project, maybe 10-15 seconds. That&amp;rsquo;s it.&lt;/p&gt;</description></item><item><title>What I Actually Miss From C#</title><link>https://stepinto.dev/posts/dotnet-to-go-what-i-miss/</link><pubDate>Wed, 15 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-what-i-miss/</guid><description>&lt;p&gt;I&amp;rsquo;ve been writing Go full-time for a couple of months now. I like it. I&amp;rsquo;m productive. But let&amp;rsquo;s be honest: there are things I miss from C#. Not everything Go does differently is better, and pretending otherwise would be tribal nonsense.&lt;/p&gt;&#10;&lt;p&gt;Here&amp;rsquo;s my genuine list of features I wish Go had. Not complaints, just honest observations about trade-offs.&lt;/p&gt;&#10;&lt;h2 id="linq" id="linq"&gt;LINQ&lt;a href="#linq" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;God, I miss LINQ.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;activeUsers&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;u&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IsActive&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;OrderBy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;u&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Select&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;u&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ToList&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In Go:&lt;/p&gt;</description></item><item><title>AWS Lambda and Go: Cold Starts That Don't Hurt</title><link>https://stepinto.dev/posts/dotnet-to-go-lambda/</link><pubDate>Sun, 05 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-lambda/</guid><description>&lt;p&gt;If you&amp;rsquo;ve run .NET on Lambda, you know the cold start pain. 3-5 seconds for a managed runtime. Even Native AOT helps but doesn&amp;rsquo;t eliminate it.&lt;/p&gt;&#10;&lt;p&gt;Go on Lambda cold starts in ~100-200ms. Sometimes faster. Same static binary advantage you get everywhere else, just applied to serverless.&lt;/p&gt;&#10;&lt;h2 id="go-lambda-basics" id="go-lambda-basics"&gt;Go Lambda Basics&lt;a href="#go-lambda-basics" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;package&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;context&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;github.com/aws/aws-lambda-go/lambda&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Request&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;struct&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;`json:&amp;#34;name&amp;#34;`&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Response&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;struct&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Message&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;`json:&amp;#34;message&amp;#34;`&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Response&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Response&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Hello, &amp;#34;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;lambda&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Start&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Build and deploy:&lt;/p&gt;</description></item><item><title>Dockerfile for Go: Simpler Than You'd Think</title><link>https://stepinto.dev/posts/dotnet-to-go-docker/</link><pubDate>Sun, 05 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-docker/</guid><description>&lt;p&gt;Go&amp;rsquo;s static binaries make for tiny Docker images. Where a .NET container might be 200MB+, a Go container can be under 20MB. Sometimes under 10MB.&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;Update, November 2026: The &lt;code&gt;golang:1.22&lt;/code&gt; and &lt;code&gt;alpine:3.19&lt;/code&gt; pins below are out of support. Pin &lt;code&gt;golang:1&lt;/code&gt; and let go.mod choose the toolchain. &lt;a href="https://stepinto.dev/posts/dotnet-to-go-what-i-got-wrong/"&gt;What I got wrong about Go&lt;/a&gt; has the details, checked against Go 1.27.&lt;/em&gt;&lt;/p&gt;&#10;&lt;p&gt;This isn&amp;rsquo;t just about bragging rights. Smaller images mean faster pulls, faster scaling, smaller attack surface, and lower storage costs.&lt;/p&gt;</description></item><item><title>GitHub Actions for Go Projects</title><link>https://stepinto.dev/posts/dotnet-to-go-github-actions/</link><pubDate>Sun, 05 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-github-actions/</guid><description>&lt;p&gt;CI/CD for Go projects is refreshingly simple. Fast builds, built-in testing, cross-compilation. Everything you need is in the standard toolchain.&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;Update, November 2026: &lt;code&gt;go-version: '1.22'&lt;/code&gt; should now be &lt;code&gt;go-version-file: go.mod&lt;/code&gt;, and the action pins have moved to &lt;code&gt;setup-go@v7&lt;/code&gt; and &lt;code&gt;golangci-lint-action@v9&lt;/code&gt;. &lt;a href="https://stepinto.dev/posts/dotnet-to-go-what-i-got-wrong/"&gt;What I got wrong about Go&lt;/a&gt; has the details, checked against Go 1.27.&lt;/em&gt;&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s set up a proper GitHub Actions workflow.&lt;/p&gt;&#10;&lt;h2 id="basic-workflow" id="basic-workflow"&gt;Basic Workflow&lt;a href="#basic-workflow" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;&lt;code&gt;.github/workflows/ci.yml&lt;/code&gt;:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;CI&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;push&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;branches&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="l"&gt;main]&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;pull_request&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;branches&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="l"&gt;main]&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;jobs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;test&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;runs-on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;ubuntu-latest&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;actions/checkout@v4&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Set up Go&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;actions/setup-go@v5&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;with&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;go-version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;1.22&amp;#39;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Download dependencies&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;run&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;go mod download&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Test&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;run&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;go test -v ./...&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That&amp;rsquo;s a working CI pipeline. Test on every push and PR.&lt;/p&gt;</description></item><item><title>Health Checks and Readiness Probes</title><link>https://stepinto.dev/posts/dotnet-to-go-health-checks/</link><pubDate>Sun, 05 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-health-checks/</guid><description>&lt;p&gt;We touched on health checks in the Kubernetes post. Let&amp;rsquo;s go deeper. Proper health checks that actually tell orchestrators useful information.&lt;/p&gt;&#10;&lt;h2 id="the-three-probes" id="the-three-probes"&gt;The Three Probes&lt;a href="#the-three-probes" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;Kubernetes (and similar orchestrators) use three types of probes:&lt;/p&gt;&#10;&lt;table&gt;&#10;&#9;&lt;thead&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Probe&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Question&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Failure Action&lt;/th&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/thead&gt;&#10;&#9;&lt;tbody&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;strong&gt;Liveness&lt;/strong&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Is the process alive?&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Restart container&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;strong&gt;Readiness&lt;/strong&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Can it handle traffic?&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Remove from load balancer&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;strong&gt;Startup&lt;/strong&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Has it finished starting?&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Keep waiting&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;p&gt;Getting these right matters for reliability.&lt;/p&gt;&#10;&lt;h2 id="liveness-am-i-alive" id="liveness-am-i-alive"&gt;Liveness: Am I Alive?&lt;a href="#liveness-am-i-alive" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;Liveness should answer: &amp;ldquo;Is this process fundamentally broken?&amp;rdquo;&lt;/p&gt;</description></item><item><title>Kubernetes and Go: A Natural Fit</title><link>https://stepinto.dev/posts/dotnet-to-go-kubernetes/</link><pubDate>Sun, 05 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-kubernetes/</guid><description>&lt;p&gt;Kubernetes is written in Go. The CLI tools are Go. The ecosystem is Go. Running Go services on Kubernetes feels natural. The patterns align.&lt;/p&gt;&#10;&lt;p&gt;But there are things you need to get right: health checks, graceful shutdown, resource limits. Let&amp;rsquo;s cover what Kubernetes expects and how Go delivers it.&lt;/p&gt;&#10;&lt;h2 id="health-checks-liveness-and-readiness" id="health-checks-liveness-and-readiness"&gt;Health Checks: Liveness and Readiness&lt;a href="#health-checks-liveness-and-readiness" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;Kubernetes uses probes to manage your containers:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Liveness&lt;/strong&gt;: Is the process alive? Restart if not.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Readiness&lt;/strong&gt;: Can it serve traffic? Remove from load balancer if not.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Startup&lt;/strong&gt;: Has it finished starting? (For slow-starting apps)&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 id="implementing-health-endpoints" id="implementing-health-endpoints"&gt;Implementing Health Endpoints&lt;a href="#implementing-health-endpoints" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h3&gt;&#10;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;package&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;net/http&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;sync/atomic&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;ready&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;atomic&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Bool&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// Health endpoints&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;HandleFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;/healthz&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;healthzHandler&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// liveness&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;HandleFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;/readyz&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;readyzHandler&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// readiness&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// Your app routes&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;HandleFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;/&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;appHandler&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// Start background initialization&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;go&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;initializeApp&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;ready&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Store&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}()&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ListenAndServe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;:8080&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;healthzHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// Liveness: can we respond at all?&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;StatusOK&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="nb"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;ok&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;readyzHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// Readiness: are we ready to serve traffic?&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;ready&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Load&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;StatusOK&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="nb"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;ok&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;StatusServiceUnavailable&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="nb"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;not ready&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="kubernetes-manifest" id="kubernetes-manifest"&gt;Kubernetes Manifest&lt;a href="#kubernetes-manifest" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h3&gt;&#10;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;apiVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;apps/v1&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Deployment&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;myapp&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;replicas&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;selector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;matchLabels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;app&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;myapp&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;template&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;labels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;app&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;myapp&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;containers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;myapp&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;myapp:latest&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;ports&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;containerPort&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;8080&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;livenessProbe&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;httpGet&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;/healthz&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;8080&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;initialDelaySeconds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;periodSeconds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;readinessProbe&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;httpGet&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;/readyz&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;8080&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;initialDelaySeconds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;periodSeconds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;resources&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;64Mi&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;cpu&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;100m&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;limits&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;128Mi&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;cpu&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;500m&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="graceful-shutdown" id="graceful-shutdown"&gt;Graceful Shutdown&lt;a href="#graceful-shutdown" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;When Kubernetes wants to stop your pod, it sends SIGTERM. You have &lt;code&gt;terminationGracePeriodSeconds&lt;/code&gt; (default 30) to finish in-flight requests before SIGKILL.&lt;/p&gt;</description></item><item><title>Metrics, Traces, and Logs: The OpenTelemetry Way</title><link>https://stepinto.dev/posts/dotnet-to-go-observability/</link><pubDate>Sun, 05 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-observability/</guid><description>&lt;p&gt;Observability in production means three things: metrics (what&amp;rsquo;s happening), traces (how requests flow), and logs (what went wrong). OpenTelemetry unifies all three.&lt;/p&gt;&#10;&lt;p&gt;Go&amp;rsquo;s OpenTelemetry support is mature. The project itself is Go-native. Let&amp;rsquo;s instrument a Go service properly.&lt;/p&gt;&#10;&lt;h2 id="opentelemetry-setup" id="opentelemetry-setup"&gt;OpenTelemetry Setup&lt;a href="#opentelemetry-setup" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;Add dependencies:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;go get go.opentelemetry.io/otel&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;go get go.opentelemetry.io/otel/sdk&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;go get go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;go get go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;go get go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Initialize in main:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;package&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;context&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;log&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;time&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;go.opentelemetry.io/otel&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;go.opentelemetry.io/otel/sdk/resource&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;sdktrace&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;go.opentelemetry.io/otel/sdk/trace&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;semconv&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;go.opentelemetry.io/otel/semconv/v1.24.0&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;initTracer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nx"&gt;sdktrace&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;TracerProvider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;exporter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;otlptracehttp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;resource&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;resource&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WithAttributes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;semconv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ServiceName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;myservice&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;semconv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ServiceVersion&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;1.0.0&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;tp&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;sdktrace&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;NewTracerProvider&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;sdktrace&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WithBatcher&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;exporter&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;sdktrace&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WithResource&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;otel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;SetTracerProvider&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;tp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Background&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;tp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;initTracer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Fatal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;defer&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;tp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Shutdown&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// Your app...&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="automatic-http-instrumentation" id="automatic-http-instrumentation"&gt;Automatic HTTP Instrumentation&lt;a href="#automatic-http-instrumentation" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;Wrap your HTTP handler:&lt;/p&gt;</description></item><item><title>Shrinking Binaries and Build Tags</title><link>https://stepinto.dev/posts/dotnet-to-go-build-tags/</link><pubDate>Sun, 05 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-build-tags/</guid><description>&lt;p&gt;Go binaries are already small compared to .NET self-contained deployments. But sometimes you want smaller: Lambda deployments, embedded systems, or just because.&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s look at &lt;code&gt;ldflags&lt;/code&gt; for stripping binaries and build tags for conditional compilation.&lt;/p&gt;&#10;&lt;h2 id="stripping-with-ldflags" id="stripping-with-ldflags"&gt;Stripping with ldflags&lt;a href="#stripping-with-ldflags" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;The simplest optimisation:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;go build -ldflags&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;-s -w&amp;#34;&lt;/span&gt; -o myapp&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;table&gt;&#10;&#9;&lt;thead&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Flag&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Effect&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Size Impact&lt;/th&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/thead&gt;&#10;&#9;&lt;tbody&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;-s&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Strip symbol table&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;~15-20% smaller&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;-w&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Strip DWARF debug info&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;~10-15% smaller&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;p&gt;Combined, you might see 25-30% reduction.&lt;/p&gt;</description></item><item><title>Single Binary Deploys: The Killer Feature</title><link>https://stepinto.dev/posts/dotnet-to-go-single-binary/</link><pubDate>Sun, 05 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-single-binary/</guid><description>&lt;p&gt;What sold me on Go for production: you build a binary, you copy it to a server, you run it. No runtime to install. No framework version matching. No dependency hell. Just a file.&lt;/p&gt;&#10;&lt;p&gt;If you&amp;rsquo;ve ever dealt with .NET runtime versioning on servers, or debugged why &lt;code&gt;dotnet&lt;/code&gt; can&amp;rsquo;t find the right SDK, or explained to ops why they need to install framework X before deploying your app, Go&amp;rsquo;s deployment model will feel like a revelation.&lt;/p&gt;</description></item><item><title>Versioning Your Modules</title><link>https://stepinto.dev/posts/dotnet-to-go-versioning/</link><pubDate>Sun, 05 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-versioning/</guid><description>&lt;p&gt;Versioning in Go is simple in concept (semantic versioning with git tags) but has quirks that&amp;rsquo;ll catch you if you&amp;rsquo;re coming from NuGet&amp;rsquo;s more flexible model.&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s cover how to version your modules properly.&lt;/p&gt;&#10;&lt;h2 id="basic-versioning" id="basic-versioning"&gt;Basic Versioning&lt;a href="#basic-versioning" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;Go modules use semantic versioning: &lt;code&gt;vMAJOR.MINOR.PATCH&lt;/code&gt;&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;v1.0.0 - initial stable release&#10;v1.1.0 - new features, backward compatible&#10;v1.1.1 - bug fixes&#10;v2.0.0 - breaking changes&#10;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Version with git tags:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git tag v1.0.0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git push origin v1.0.0&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That&amp;rsquo;s it. No version numbers in code, no configuration files to update.&lt;/p&gt;</description></item><item><title>Configuration Without IOptions&lt;T&gt;</title><link>https://stepinto.dev/posts/dotnet-to-go-config/</link><pubDate>Sat, 04 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-config/</guid><description>&lt;p&gt;In ASP.NET Core, configuration is a whole subsystem. &lt;code&gt;IConfiguration&lt;/code&gt;, &lt;code&gt;IOptions&amp;lt;T&amp;gt;&lt;/code&gt;, &lt;code&gt;IOptionsSnapshot&amp;lt;T&amp;gt;&lt;/code&gt;, &lt;code&gt;IOptionsMonitor&amp;lt;T&amp;gt;&lt;/code&gt;, multiple providers, hot reload, dependency injection integration&amp;hellip; It&amp;rsquo;s sophisticated. Maybe too sophisticated.&lt;/p&gt;&#10;&lt;p&gt;Go doesn&amp;rsquo;t have a standard configuration library. The community uses environment variables, simple file parsing, or third-party libraries. It&amp;rsquo;s less powerful and often exactly what you need.&lt;/p&gt;&#10;&lt;h2 id="the-simplest-approach-environment-variables" id="the-simplest-approach-environment-variables"&gt;The Simplest Approach: Environment Variables&lt;a href="#the-simplest-approach-environment-variables" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;The Go standard library makes environment variables easy:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;port&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;PORT&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;port&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;port&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;8080&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;dbURL&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;DATABASE_URL&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;dbURL&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Fatal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;DATABASE_URL required&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That&amp;rsquo;s it. No configuration provider chain. No dependency injection. Just read the environment.&lt;/p&gt;</description></item><item><title>Database Access: database/sql vs Entity Framework</title><link>https://stepinto.dev/posts/dotnet-to-go-database/</link><pubDate>Sat, 04 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-database/</guid><description>&lt;p&gt;Entity Framework is an ORM. It maps objects to tables, generates SQL, tracks changes, handles migrations. You can build entire applications barely writing SQL.&lt;/p&gt;&#10;&lt;p&gt;Go&amp;rsquo;s &lt;code&gt;database/sql&lt;/code&gt; is a thin abstraction over database drivers. You write SQL. You scan results into structs. There&amp;rsquo;s no change tracking, no LINQ, no automatic migrations.&lt;/p&gt;&#10;&lt;p&gt;This is going to feel like stepping back twenty years. But there&amp;rsquo;s value in the simplicity.&lt;/p&gt;&#10;&lt;h2 id="the-basics" id="the-basics"&gt;The Basics&lt;a href="#the-basics" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;Connect to a database:&lt;/p&gt;</description></item><item><title>Debugging: Delve vs Visual Studio's Comfort</title><link>https://stepinto.dev/posts/dotnet-to-go-debugging/</link><pubDate>Sat, 04 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-debugging/</guid><description>&lt;p&gt;Visual Studio&amp;rsquo;s debugger is exceptional. Breakpoints, watch expressions, edit-and-continue, conditional breakpoints, data tips, memory inspection, async debugging&amp;hellip; You can debug anything, easily.&lt;/p&gt;&#10;&lt;p&gt;Go&amp;rsquo;s debugger is Delve (&lt;code&gt;dlv&lt;/code&gt;). It&amp;rsquo;s good. It&amp;rsquo;s not Visual Studio.&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s get you productive with what Go offers.&lt;/p&gt;&#10;&lt;h2 id="delve-basics" id="delve-basics"&gt;Delve Basics&lt;a href="#delve-basics" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;Install:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;go install github.com/go-delve/delve/cmd/dlv@latest&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Start debugging:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Debug current package&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dlv debug&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Debug specific package&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dlv debug ./cmd/server&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Debug a test&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dlv &lt;span class="nb"&gt;test&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Attach to running process&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dlv attach &amp;lt;pid&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="command-line-debugging" id="command-line-debugging"&gt;Command-Line Debugging&lt;a href="#command-line-debugging" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;Inside &lt;code&gt;dlv&lt;/code&gt;:&lt;/p&gt;</description></item><item><title>Generate All the Things</title><link>https://stepinto.dev/posts/dotnet-to-go-generate/</link><pubDate>Sat, 04 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-generate/</guid><description>&lt;p&gt;Go developers love code generation. Where C# uses reflection, attributes, and source generators, Go often uses tools that generate code before compilation.&lt;/p&gt;&#10;&lt;p&gt;This sounds backwards. Writing code that writes code? But it has advantages: generated code is inspectable, debuggable, and has zero runtime overhead.&lt;/p&gt;&#10;&lt;h2 id="the-go-generate-command" id="the-go-generate-command"&gt;The go generate Command&lt;a href="#the-go-generate-command" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;Add a magic comment to your source file:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="cp"&gt;//go:generate stringer -type=Status&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Status&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;const&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;StatusPending&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Status&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;iota&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;StatusActive&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;StatusCompleted&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Run:&lt;/p&gt;</description></item><item><title>GORM and Friends: When You Do Want an ORM</title><link>https://stepinto.dev/posts/dotnet-to-go-gorm/</link><pubDate>Sat, 04 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-gorm/</guid><description>&lt;p&gt;Despite Go&amp;rsquo;s &amp;ldquo;just write SQL&amp;rdquo; culture, ORMs exist and are popular. GORM is the most widely used. If you&amp;rsquo;re coming from Entity Framework and miss the productivity, GORM might ease the transition.&lt;/p&gt;&#10;&lt;p&gt;Fair warning: GORM is controversial in the Go community. Some love it, many avoid it. Let&amp;rsquo;s look at what it offers and the trade-offs.&lt;/p&gt;&#10;&lt;h2 id="basic-gorm-usage" id="basic-gorm-usage"&gt;Basic GORM Usage&lt;a href="#basic-gorm-usage" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;Define a model:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;gorm.io/gorm&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;User&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;struct&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;ID&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;uint&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;`gorm:&amp;#34;primaryKey&amp;#34;`&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;`gorm:&amp;#34;size:255;not null&amp;#34;`&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Email&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;`gorm:&amp;#34;uniqueIndex;not null&amp;#34;`&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Age&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;CreatedAt&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Time&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;UpdatedAt&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Time&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;DeletedAt&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;gorm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DeletedAt&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;`gorm:&amp;#34;index&amp;#34;`&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// soft delete&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Connect and auto-migrate:&lt;/p&gt;</description></item><item><title>HTTP Services: net/http vs ASP.NET Core</title><link>https://stepinto.dev/posts/dotnet-to-go-http/</link><pubDate>Sat, 04 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-http/</guid><description>&lt;p&gt;ASP.NET Core is a sophisticated web framework. Dependency injection, middleware pipelines, model binding, routing with attributes, OpenAPI generation&amp;hellip; it does a lot for you.&lt;/p&gt;&#10;&lt;p&gt;Go&amp;rsquo;s &lt;code&gt;net/http&lt;/code&gt; is a standard library package. It does HTTP. That&amp;rsquo;s about it.&lt;/p&gt;&#10;&lt;p&gt;This sounds like a step down. It is, in some ways. But there&amp;rsquo;s power in simplicity, and Go&amp;rsquo;s HTTP story is more capable than it first appears.&lt;/p&gt;&#10;&lt;h2 id="the-simplest-server" id="the-simplest-server"&gt;The Simplest Server&lt;a href="#the-simplest-server" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;Go:&lt;/p&gt;</description></item><item><title>JSON: Struct Tags and the Marshal Dance</title><link>https://stepinto.dev/posts/dotnet-to-go-json/</link><pubDate>Sat, 04 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-json/</guid><description>&lt;p&gt;In C#, you add &lt;code&gt;[JsonProperty(&amp;quot;name&amp;quot;)]&lt;/code&gt; or rely on naming conventions. The serializer figures out the rest. Newtonsoft.Json has been battle-tested for over a decade, and System.Text.Json is catching up fast.&lt;/p&gt;&#10;&lt;p&gt;Go&amp;rsquo;s &lt;code&gt;encoding/json&lt;/code&gt; is simpler. Not worse, necessarily, but definitely more manual. And it has quirks that&amp;rsquo;ll catch you out.&lt;/p&gt;&#10;&lt;h2 id="the-basics" id="the-basics"&gt;The Basics&lt;a href="#the-basics" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;Go uses &lt;strong&gt;struct tags&lt;/strong&gt; to control JSON field names:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;User&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;struct&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;ID&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;`json:&amp;#34;id&amp;#34;`&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;FirstName&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;`json:&amp;#34;first_name&amp;#34;`&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Email&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;`json:&amp;#34;email&amp;#34;`&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;CreatedAt&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Time&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;`json:&amp;#34;created_at&amp;#34;`&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Those backtick strings are struct tags. The &lt;code&gt;json&lt;/code&gt; key tells the JSON encoder how to handle each field.&lt;/p&gt;</description></item><item><title>Linting and Formatting: gofmt Is Non-Negotiable</title><link>https://stepinto.dev/posts/dotnet-to-go-linting/</link><pubDate>Sat, 04 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-linting/</guid><description>&lt;p&gt;In C#, code formatting is a matter of preference. Tabs or spaces? Braces on the same line or next? Teams debate, &lt;code&gt;.editorconfig&lt;/code&gt; files proliferate, and nobody quite agrees.&lt;/p&gt;&#10;&lt;p&gt;In Go, formatting is not a discussion. &lt;code&gt;gofmt&lt;/code&gt; defines the One True Format, and everyone uses it. There is no debate because there&amp;rsquo;s no choice.&lt;/p&gt;&#10;&lt;p&gt;This sounds authoritarian. It&amp;rsquo;s actually liberating.&lt;/p&gt;&#10;&lt;h2 id="gofmt-the-formatter" id="gofmt-the-formatter"&gt;gofmt: The Formatter&lt;a href="#gofmt-the-formatter" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;Every Go file should be formatted by &lt;code&gt;gofmt&lt;/code&gt;:&lt;/p&gt;</description></item><item><title>Logging: slog and the Structured Logging Story</title><link>https://stepinto.dev/posts/dotnet-to-go-logging/</link><pubDate>Sat, 04 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-logging/</guid><description>&lt;p&gt;For years, Go&amp;rsquo;s logging story was &amp;ldquo;use the &lt;code&gt;log&lt;/code&gt; package or pick a third-party library.&amp;rdquo; The standard &lt;code&gt;log&lt;/code&gt; package is basic: no levels, no structure, no context. Everyone used zerolog, zap, or logrus.&lt;/p&gt;&#10;&lt;p&gt;Then Go 1.21 shipped &lt;code&gt;log/slog&lt;/code&gt;. Finally, structured logging in the standard library. And it&amp;rsquo;s actually good.&lt;/p&gt;&#10;&lt;h2 id="the-old-way-log-package" id="the-old-way-log-package"&gt;The Old Way: log Package&lt;a href="#the-old-way-log-package" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;Go&amp;rsquo;s original &lt;code&gt;log&lt;/code&gt; package:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;log&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;server starting&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;listening on port %d&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;8080&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Fatal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;failed to connect&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// logs and calls os.Exit(1)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Output:&lt;/p&gt;</description></item><item><title>Benchmarks and Profiling Out of the Box</title><link>https://stepinto.dev/posts/dotnet-to-go-benchmarks/</link><pubDate>Fri, 03 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-benchmarks/</guid><description>&lt;p&gt;Here&amp;rsquo;s something that surprised me: Go has built-in benchmarking. No BenchmarkDotNet to install. No configuration. Write a function, run &lt;code&gt;go test -bench&lt;/code&gt;, get numbers.&lt;/p&gt;&#10;&lt;p&gt;And profiling? Also built in. CPU profiles, memory profiles, blocking profiles. All from the standard toolchain.&lt;/p&gt;&#10;&lt;p&gt;Coming from .NET where you install BenchmarkDotNet for proper benchmarks and a separate profiler for profiling, Go&amp;rsquo;s integrated approach is refreshing.&lt;/p&gt;&#10;&lt;h2 id="writing-benchmarks" id="writing-benchmarks"&gt;Writing Benchmarks&lt;a href="#writing-benchmarks" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;&lt;em&gt;Update, November 2026: Go 1.24 added &lt;code&gt;b.Loop()&lt;/code&gt;, which replaces every &lt;code&gt;b.N&lt;/code&gt; loop below and stops the compiler deleting the body, which it does to the first example here. &lt;a href="https://stepinto.dev/posts/dotnet-to-go-what-i-got-wrong/"&gt;What I got wrong about Go&lt;/a&gt; has the details, checked against Go 1.27.&lt;/em&gt;&lt;/p&gt;</description></item><item><title>Mocking in a Language Without Mockito</title><link>https://stepinto.dev/posts/dotnet-to-go-mocking/</link><pubDate>Fri, 03 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-mocking/</guid><description>&lt;p&gt;In C#, you reach for Moq or NSubstitute without thinking. Interface? Mock it. Verify calls? Easy. Set up return values? One line.&lt;/p&gt;&#10;&lt;p&gt;Go doesn&amp;rsquo;t have a standard mocking framework. There&amp;rsquo;s no reflection-based proxy generation. No &lt;code&gt;Mock&amp;lt;IUserService&amp;gt;()&lt;/code&gt;. The Go way is more manual, and that&amp;rsquo;s&amp;hellip; actually fine? Let me explain.&lt;/p&gt;&#10;&lt;h2 id="the-c-approach" id="the-c-approach"&gt;The C# Approach&lt;a href="#the-c-approach" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;You&amp;rsquo;ve done this a thousand times:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="k"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;IUserRepository&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;User&lt;/span&gt; &lt;span class="n"&gt;GetById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="n"&gt;Save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[Fact]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="n"&gt;ProcessUser_CallsRepository&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;mockRepo&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Mock&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;IUserRepository&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;();&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;mockRepo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Setup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="n"&gt;Returns&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;User&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;Id&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;&amp;#34;Alice&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;service&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;UserService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mockRepo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Process&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;mockRepo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Verify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;Times&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Once&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Clean, expressive, powerful. Moq generates a proxy class at runtime that implements the interface and records calls.&lt;/p&gt;</description></item><item><title>Multi-Module Repos: Monorepo Thinking</title><link>https://stepinto.dev/posts/dotnet-to-go-monorepo/</link><pubDate>Fri, 03 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-monorepo/</guid><description>&lt;p&gt;Most Go projects have one &lt;code&gt;go.mod&lt;/code&gt; file at the root. One module, one version, simple. But what happens when your repo grows? When you have shared libraries, multiple services, and teams stepping on each other&amp;rsquo;s toes?&lt;/p&gt;&#10;&lt;p&gt;You need multiple modules. And Go&amp;rsquo;s support for this is&amp;hellip; functional. Not beautiful, but functional.&lt;/p&gt;&#10;&lt;h2 id="when-one-module-isnt-enough" id="when-one-module-isnt-enough"&gt;When One Module Isn&amp;rsquo;t Enough&lt;a href="#when-one-module-isnt-enough" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;Stick with one module when you can. But consider multiple modules when:&lt;/p&gt;</description></item><item><title>Organising a Real Project</title><link>https://stepinto.dev/posts/dotnet-to-go-project-structure/</link><pubDate>Fri, 03 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-project-structure/</guid><description>&lt;p&gt;So you&amp;rsquo;ve got the basics. You can write Go code. Now you need to organise it into something that won&amp;rsquo;t become a tangled mess in six months.&lt;/p&gt;&#10;&lt;p&gt;Go has opinions about project structure. Some are enforced by the compiler. Some are conventions so universal they might as well be enforced. Coming from .NET&amp;rsquo;s solution/project/namespace hierarchy, Go&amp;rsquo;s flat package model takes adjustment.&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s figure out how to structure a real project.&lt;/p&gt;</description></item><item><title>Testing Without a Framework</title><link>https://stepinto.dev/posts/dotnet-to-go-testing/</link><pubDate>Fri, 03 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-testing/</guid><description>&lt;p&gt;In C#, you pick a test framework: xUnit, NUnit, MSTest. You install packages. You learn attributes. You configure test runners.&lt;/p&gt;&#10;&lt;p&gt;In Go, you run &lt;code&gt;go test&lt;/code&gt;. That&amp;rsquo;s it. There&amp;rsquo;s one testing approach, it&amp;rsquo;s built in, and it&amp;rsquo;s been there since the beginning.&lt;/p&gt;&#10;&lt;p&gt;This felt limiting at first. &amp;ldquo;Where are my attributes? Where&amp;rsquo;s my dependency injection? Where&amp;rsquo;s my &lt;code&gt;[Theory]&lt;/code&gt; with &lt;code&gt;[InlineData]&lt;/code&gt;?&amp;rdquo; Then I wrote some tests and realised: Go&amp;rsquo;s simplicity is the point.&lt;/p&gt;</description></item><item><title>Composition Over Inheritance (For Real This Time)</title><link>https://stepinto.dev/posts/dotnet-to-go-composition/</link><pubDate>Thu, 02 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-composition/</guid><description>&lt;p&gt;We&amp;rsquo;ve all heard &amp;ldquo;favour composition over inheritance.&amp;rdquo; We&amp;rsquo;ve all nodded sagely. And then we&amp;rsquo;ve all written class hierarchies three levels deep because, well, it&amp;rsquo;s right there and it&amp;rsquo;s easy.&lt;/p&gt;&#10;&lt;p&gt;Go doesn&amp;rsquo;t give you the choice. There&amp;rsquo;s no inheritance. Zero. You can&amp;rsquo;t extend a type. You can&amp;rsquo;t override methods. There&amp;rsquo;s no &lt;code&gt;virtual&lt;/code&gt;, no &lt;code&gt;abstract&lt;/code&gt;, no &lt;code&gt;base&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;Instead, Go has &lt;strong&gt;embedding&lt;/strong&gt;, a form of composition that feels almost like inheritance but isn&amp;rsquo;t. And after using it for a while, I actually don&amp;rsquo;t miss base classes.&lt;/p&gt;</description></item><item><title>Implicit Interfaces: Scary Then Brilliant</title><link>https://stepinto.dev/posts/dotnet-to-go-interfaces/</link><pubDate>Thu, 02 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-interfaces/</guid><description>&lt;p&gt;Here&amp;rsquo;s a sentence that&amp;rsquo;ll make every C# developer uncomfortable: Go interfaces don&amp;rsquo;t require an &lt;code&gt;implements&lt;/code&gt; keyword. You never explicitly declare that a type implements an interface. If your type has the right methods, it implements the interface. Automatically. Implicitly.&lt;/p&gt;&#10;&lt;p&gt;This sounds like chaos. It felt like chaos to me for the first week. Then it clicked, and now C#&amp;rsquo;s explicit interface declarations feel like unnecessary paperwork.&lt;/p&gt;&#10;&lt;h2 id="the-c-way-explicit-declaration" id="the-c-way-explicit-declaration"&gt;The C# Way: Explicit Declaration&lt;a href="#the-c-way-explicit-declaration" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;In C#, implementing an interface is a contract you sign explicitly:&lt;/p&gt;</description></item><item><title>The Empty Interface and Type Assertions</title><link>https://stepinto.dev/posts/dotnet-to-go-any/</link><pubDate>Thu, 02 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-any/</guid><description>&lt;p&gt;Go has a type called &lt;code&gt;any&lt;/code&gt;. Before Go 1.18, it was written &lt;code&gt;interface{}&lt;/code&gt;. Same thing, nicer name. And it&amp;rsquo;s basically Go&amp;rsquo;s version of &lt;code&gt;object&lt;/code&gt;, the type that can hold anything.&lt;/p&gt;&#10;&lt;p&gt;Every type in Go implements &lt;code&gt;any&lt;/code&gt; because &lt;code&gt;any&lt;/code&gt; has no methods. Zero requirements means universal satisfaction. And that means when you use &lt;code&gt;any&lt;/code&gt;, you&amp;rsquo;re opting out of the type system.&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s talk about when that&amp;rsquo;s okay, when it&amp;rsquo;s not, and how to get your types back when you need them.&lt;/p&gt;</description></item><item><title>Async/Await vs Goroutines: A Mindset Shift</title><link>https://stepinto.dev/posts/dotnet-to-go-goroutines/</link><pubDate>Wed, 01 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-goroutines/</guid><description>&lt;p&gt;Go&amp;rsquo;s concurrency model is going to feel backwards. You&amp;rsquo;ve spent years learning that async operations need &lt;code&gt;async&lt;/code&gt; keywords, &lt;code&gt;await&lt;/code&gt; expressions, &lt;code&gt;Task&amp;lt;T&amp;gt;&lt;/code&gt; return types, and careful thought about which thread you&amp;rsquo;re on.&lt;/p&gt;&#10;&lt;p&gt;Go throws all of that out. Any function can be concurrent. There&amp;rsquo;s no special syntax. No coloured functions. No async/await virus spreading through your codebase.&lt;/p&gt;&#10;&lt;p&gt;It feels wrong until suddenly it doesn&amp;rsquo;t.&lt;/p&gt;&#10;&lt;h2 id="the-c-model-async-all-the-way-down" id="the-c-model-async-all-the-way-down"&gt;The C# Model: Async All the Way Down&lt;a href="#the-c-model-async-all-the-way-down" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;In C#, concurrency is opt-in and explicit:&lt;/p&gt;</description></item><item><title>Channels: The sync You Didn't Know You Wanted</title><link>https://stepinto.dev/posts/dotnet-to-go-channels/</link><pubDate>Wed, 01 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-channels/</guid><description>&lt;p&gt;If goroutines are Go&amp;rsquo;s lightweight threads, channels are how they talk to each other. Think &lt;code&gt;BlockingCollection&amp;lt;T&amp;gt;&lt;/code&gt; meets message passing, with first-class language support.&lt;/p&gt;&#10;&lt;p&gt;The Go mantra is: &lt;strong&gt;&amp;ldquo;Don&amp;rsquo;t communicate by sharing memory; share memory by communicating.&amp;rdquo;&lt;/strong&gt; Channels are how you do that.&lt;/p&gt;&#10;&lt;h2 id="the-basics" id="the-basics"&gt;The Basics&lt;a href="#the-basics" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;A channel is a typed conduit for sending and receiving values:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;ch&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;make&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;chan&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// unbuffered channel of ints&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;// Send (blocks until someone receives)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;ch&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;// Receive (blocks until someone sends)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="nx"&gt;ch&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;&amp;lt;-&lt;/code&gt; operator does both sending and receiving. The arrow points in the direction of data flow.&lt;/p&gt;</description></item><item><title>Context Is King</title><link>https://stepinto.dev/posts/dotnet-to-go-context/</link><pubDate>Wed, 01 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-context/</guid><description>&lt;p&gt;Every Go function that does I/O, might take a while, or should be cancellable will take a &lt;code&gt;context.Context&lt;/code&gt; as its first parameter. It&amp;rsquo;s Go&amp;rsquo;s answer to &lt;code&gt;CancellationToken&lt;/code&gt;, plus request-scoped values, all in one.&lt;/p&gt;&#10;&lt;p&gt;If you&amp;rsquo;re not using context properly, you&amp;rsquo;re not writing idiomatic Go. It&amp;rsquo;s that fundamental.&lt;/p&gt;&#10;&lt;h2 id="the-basics" id="the-basics"&gt;The Basics&lt;a href="#the-basics" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;DoSomething&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;error&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// Check if already cancelled&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;select&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;case&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Done&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Err&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// Do work...&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Every context has a &lt;code&gt;Done()&lt;/code&gt; channel that closes when the context is cancelled. You check it periodically during long operations.&lt;/p&gt;</description></item><item><title>Mutexes and WaitGroups: When Channels Aren't the Answer</title><link>https://stepinto.dev/posts/dotnet-to-go-sync/</link><pubDate>Wed, 01 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-sync/</guid><description>&lt;p&gt;Go&amp;rsquo;s mantra is &amp;ldquo;share memory by communicating,&amp;rdquo; but sometimes you just need a bloody mutex. The &lt;code&gt;sync&lt;/code&gt; package has all the primitives you know from C#, and knowing when to use them vs channels is part of becoming proficient in Go.&lt;/p&gt;&#10;&lt;h2 id="syncmutex" id="syncmutex"&gt;sync.Mutex&lt;a href="#syncmutex" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;The classic lock:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Counter&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;struct&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;mu&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;sync&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Mutex&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nx"&gt;Counter&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;Increment&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Lock&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;defer&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Unlock&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nx"&gt;Counter&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;Value&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Lock&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;defer&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Unlock&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In C#:&lt;/p&gt;</description></item><item><title>select: Multiplexing Like a Pro</title><link>https://stepinto.dev/posts/dotnet-to-go-select/</link><pubDate>Wed, 01 Jan 2025 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-select/</guid><description>&lt;p&gt;The &lt;code&gt;select&lt;/code&gt; statement is where Go&amp;rsquo;s channel system goes from &amp;ldquo;neat&amp;rdquo; to &amp;ldquo;powerful.&amp;rdquo; It lets you wait on multiple channel operations simultaneously, handle timeouts, and do non-blocking checks. All with clean syntax.&lt;/p&gt;&#10;&lt;p&gt;C# doesn&amp;rsquo;t have a direct equivalent. The closest is &lt;code&gt;Task.WhenAny&lt;/code&gt;, but &lt;code&gt;select&lt;/code&gt; is more flexible and more deeply integrated.&lt;/p&gt;&#10;&lt;h2 id="basic-select" id="basic-select"&gt;Basic select&lt;a href="#basic-select" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;&lt;code&gt;select&lt;/code&gt; waits on multiple channel operations and executes whichever is ready first:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;select&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;case&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="nx"&gt;ch1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;fmt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;received from ch1:&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;case&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="nx"&gt;ch2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;fmt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;received from ch2:&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If both channels have data, one is chosen randomly (fair scheduling). If neither has data, &lt;code&gt;select&lt;/code&gt; blocks until one does.&lt;/p&gt;</description></item><item><title>Pointers Without the Pain</title><link>https://stepinto.dev/posts/dotnet-to-go-pointers/</link><pubDate>Tue, 31 Dec 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-pointers/</guid><description>&lt;p&gt;Right, let&amp;rsquo;s talk about pointers. If you&amp;rsquo;ve spent your career in C#, you&amp;rsquo;ve probably used pointers approximately never. Maybe you&amp;rsquo;ve seen &lt;code&gt;unsafe&lt;/code&gt; blocks in performance-critical library code. Maybe you&amp;rsquo;ve used &lt;code&gt;ref&lt;/code&gt; and &lt;code&gt;Span&amp;lt;T&amp;gt;&lt;/code&gt; and felt rather clever about it.&lt;/p&gt;&#10;&lt;p&gt;In Go, pointers are everywhere. Every method receiver decision involves them. Every struct-passing decision involves them. You can&amp;rsquo;t hide from them.&lt;/p&gt;&#10;&lt;p&gt;The good news: Go&amp;rsquo;s pointers are considerably less terrifying than C&amp;rsquo;s. The bad news: you actually have to think about them now.&lt;/p&gt;</description></item><item><title>Slices Are Not Arrays (And Neither Is List&lt;T&gt;)</title><link>https://stepinto.dev/posts/dotnet-to-go-slices/</link><pubDate>Tue, 31 Dec 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-slices/</guid><description>&lt;p&gt;Every C# developer coming to Go makes the same mistake: they see &lt;code&gt;[]int&lt;/code&gt; and think &amp;ldquo;array&amp;rdquo; or &amp;ldquo;list.&amp;rdquo; It&amp;rsquo;s neither. It&amp;rsquo;s a slice, and it has semantics that will bite you if you don&amp;rsquo;t understand them.&lt;/p&gt;&#10;&lt;p&gt;This is one of those Go concepts that seems simple until it isn&amp;rsquo;t. Let&amp;rsquo;s dig in.&lt;/p&gt;&#10;&lt;h2 id="what-a-slice-actually-is" id="what-a-slice-actually-is"&gt;What a Slice Actually Is&lt;a href="#what-a-slice-actually-is" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;A slice is a struct with three fields:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;// Conceptually:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;slice&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;struct&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// pointer to underlying array&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;len&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// number of elements in use&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;cap&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// total capacity of underlying array&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When you create a slice, you&amp;rsquo;re creating this header. The actual data lives in a backing array somewhere.&lt;/p&gt;</description></item><item><title>Stack vs Heap: Go's Escape Analysis</title><link>https://stepinto.dev/posts/dotnet-to-go-escape-analysis/</link><pubDate>Tue, 31 Dec 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-escape-analysis/</guid><description>&lt;p&gt;In C#, you mostly don&amp;rsquo;t think about where variables live. Value types go on the stack (usually). Reference types go on the heap (always). The runtime and JIT make optimisations. You trust the process.&lt;/p&gt;&#10;&lt;p&gt;In Go, you still mostly don&amp;rsquo;t think about it, but for different reasons. Go decides where things live at compile time through something called escape analysis. And sometimes it makes choices that&amp;rsquo;ll surprise you.&lt;/p&gt;&#10;&lt;h2 id="the-c-mental-model" id="the-c-mental-model"&gt;The C# Mental Model&lt;a href="#the-c-mental-model" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;C#&amp;rsquo;s rules are pretty clear:&lt;/p&gt;</description></item><item><title>if err != nil: Your New Reality</title><link>https://stepinto.dev/posts/dotnet-to-go-errors/</link><pubDate>Mon, 30 Dec 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-errors/</guid><description>&lt;p&gt;Let&amp;rsquo;s address the elephant in the room. You&amp;rsquo;re going to write &lt;code&gt;if err != nil&lt;/code&gt; hundreds of times. Thousands, probably. And for the first week, you&amp;rsquo;re going to hate it.&lt;/p&gt;&#10;&lt;p&gt;Coming from C#, where exceptions handle the sad path invisibly, Go&amp;rsquo;s explicit error handling feels like a step backwards. It&amp;rsquo;s verbose. It&amp;rsquo;s repetitive. It clutters your code with what looks like boilerplate.&lt;/p&gt;&#10;&lt;p&gt;Then something shifts. You start to see what you&amp;rsquo;re gaining. Let&amp;rsquo;s work through that shift.&lt;/p&gt;</description></item><item><title>Panic and Recover: The Emergency Exit</title><link>https://stepinto.dev/posts/dotnet-to-go-panic/</link><pubDate>Mon, 30 Dec 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-panic/</guid><description>&lt;p&gt;So Go doesn&amp;rsquo;t have exceptions. Except&amp;hellip; it kind of does. They&amp;rsquo;re called &lt;code&gt;panic&lt;/code&gt; and &lt;code&gt;recover&lt;/code&gt;, and they work almost exactly like throw and catch.&lt;/p&gt;&#10;&lt;p&gt;If you use them like exceptions, other Go developers will judge you. Harshly. Let&amp;rsquo;s understand why they exist, when to use them, and why the judgment is (mostly) deserved.&lt;/p&gt;&#10;&lt;h2 id="what-panic-does" id="what-panic-does"&gt;What Panic Does&lt;a href="#what-panic-does" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;&lt;code&gt;panic&lt;/code&gt; stops normal execution and begins unwinding the stack:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;divide&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;panic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;division by zero&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;divide&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// panics here&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;fmt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// never reached&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Output:&lt;/p&gt;</description></item><item><title>The switch Statement You Always Wanted</title><link>https://stepinto.dev/posts/dotnet-to-go-switch/</link><pubDate>Mon, 30 Dec 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-switch/</guid><description>&lt;p&gt;C#&amp;rsquo;s switch statement has evolved a lot over the years. Pattern matching, switch expressions, when guards. It&amp;rsquo;s become genuinely powerful. But Go&amp;rsquo;s switch has some tricks that&amp;rsquo;ll make you wish C# worked this way.&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s look at what Go&amp;rsquo;s switch can do, including the bits that&amp;rsquo;ll trip you up.&lt;/p&gt;&#10;&lt;h2 id="basic-switch-no-fallthrough-by-default" id="basic-switch-no-fallthrough-by-default"&gt;Basic Switch: No Fallthrough by Default&lt;a href="#basic-switch-no-fallthrough-by-default" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;First surprise: Go switches don&amp;rsquo;t fall through by default.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;// C# - falls through if you forget break (historically)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;switch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s"&gt;&amp;#34;Monday&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Start of week&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// required!&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s"&gt;&amp;#34;Friday&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;End of week&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;// Go - no break needed, no fallthrough&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;switch&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;day&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;case&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Monday&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;fmt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Start of week&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// automatically breaks here&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;case&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Friday&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;fmt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;End of week&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is a genuine improvement. The C# pattern of requiring &lt;code&gt;break&lt;/code&gt; after every case was a source of bugs for decades. Go&amp;rsquo;s default (exit after each case) matches what you almost always want.&lt;/p&gt;</description></item><item><title>Generics: Late to the Party</title><link>https://stepinto.dev/posts/dotnet-to-go-generics/</link><pubDate>Sun, 29 Dec 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-generics/</guid><description>&lt;p&gt;Go shipped generics in version 1.18 (March 2022). C# has had them since 2.0 (November 2005). That&amp;rsquo;s a seventeen-year head start, and it shows.&lt;/p&gt;&#10;&lt;p&gt;If you&amp;rsquo;re coming from C# expecting the same power and flexibility, you&amp;rsquo;ll be disappointed. Go&amp;rsquo;s generics are deliberately constrained. They solve the common cases but won&amp;rsquo;t let you build the same abstractions you&amp;rsquo;re used to.&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s look at what we&amp;rsquo;ve got, what&amp;rsquo;s missing, and whether that matters.&lt;/p&gt;</description></item><item><title>No Enums? No Problem (Sort Of)</title><link>https://stepinto.dev/posts/dotnet-to-go-enums/</link><pubDate>Sun, 29 Dec 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-enums/</guid><description>&lt;p&gt;Go doesn&amp;rsquo;t have enums. Not &amp;ldquo;Go has something enum-like&amp;rdquo;. It genuinely doesn&amp;rsquo;t have a dedicated enum construct. What it has instead is constants, a clever auto-incrementing keyword called &lt;code&gt;iota&lt;/code&gt;, and convention.&lt;/p&gt;&#10;&lt;p&gt;For simple cases, this works fine. For anything more complex, you&amp;rsquo;ll miss C#&amp;rsquo;s enums more than you expect.&lt;/p&gt;&#10;&lt;h2 id="the-basic-pattern" id="the-basic-pattern"&gt;The Basic Pattern&lt;a href="#the-basic-pattern" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;In C#:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;enum&lt;/span&gt; &lt;span class="n"&gt;Status&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;Pending&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;Active&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;Completed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;Cancelled&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In Go:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Status&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;const&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;StatusPending&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Status&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;iota&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;StatusActive&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;StatusCompleted&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;StatusCancelled&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Let&amp;rsquo;s break this down:&lt;/p&gt;</description></item><item><title>The Million Dollar Mistake, Differently</title><link>https://stepinto.dev/posts/dotnet-to-go-nil/</link><pubDate>Sun, 29 Dec 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-nil/</guid><description>&lt;p&gt;Tony Hoare called null references his &amp;ldquo;billion dollar mistake.&amp;rdquo; Both C# and Go inherited some form of this mistake, but they&amp;rsquo;ve evolved to handle it differently. Neither solution is perfect.&lt;/p&gt;&#10;&lt;p&gt;If you&amp;rsquo;re coming from C# 8+ with nullable reference types enabled, Go&amp;rsquo;s approach will feel like stepping backwards. And in some ways, it is. But there&amp;rsquo;s nuance here.&lt;/p&gt;&#10;&lt;h2 id="the-c-journey" id="the-c-journey"&gt;The C# Journey&lt;a href="#the-c-journey" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;C# started with null everywhere. Any reference type could be null, always. This gave us decades of &lt;code&gt;NullReferenceException&lt;/code&gt; at runtime.&lt;/p&gt;</description></item><item><title>Where Did My Properties Go?</title><link>https://stepinto.dev/posts/dotnet-to-go-visibility/</link><pubDate>Sun, 29 Dec 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-visibility/</guid><description>&lt;p&gt;Coming from C#, one of the first things you&amp;rsquo;ll notice is that Go structs look&amp;hellip; naked. Where are the &lt;code&gt;{ get; set; }&lt;/code&gt; blocks? Where&amp;rsquo;s &lt;code&gt;private&lt;/code&gt; and &lt;code&gt;public&lt;/code&gt;? How do you encapsulate anything?&lt;/p&gt;&#10;&lt;p&gt;The answer involves capitalisation, a complete absence of properties, and a philosophy that might make you uncomfortable before it makes you productive.&lt;/p&gt;&#10;&lt;h2 id="visibility-via-capitalisation" id="visibility-via-capitalisation"&gt;Visibility via Capitalisation&lt;a href="#visibility-via-capitalisation" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;Go has exactly two visibility levels:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Exported&lt;/strong&gt; (capital first letter): visible outside the package&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Unexported&lt;/strong&gt; (lowercase first letter): visible only within the package&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;That&amp;rsquo;s it. No &lt;code&gt;public&lt;/code&gt;, &lt;code&gt;private&lt;/code&gt;, &lt;code&gt;protected&lt;/code&gt;, &lt;code&gt;internal&lt;/code&gt;. Just case.&lt;/p&gt;</description></item><item><title>Your Class Is Now a Struct (And That's Fine)</title><link>https://stepinto.dev/posts/dotnet-to-go-structs/</link><pubDate>Sun, 29 Dec 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-structs/</guid><description>&lt;p&gt;Here&amp;rsquo;s something that&amp;rsquo;ll feel wrong for about a week: Go doesn&amp;rsquo;t have classes. Not &amp;ldquo;Go has classes but calls them something else&amp;rdquo;. It really doesn&amp;rsquo;t have them. No inheritance. No class hierarchies. No &lt;code&gt;virtual&lt;/code&gt; or &lt;code&gt;override&lt;/code&gt;. No &lt;code&gt;protected&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;If you&amp;rsquo;ve spent years designing C# class hierarchies, this feels like having a limb removed. Then you start writing Go code and realise&amp;hellip; you don&amp;rsquo;t actually miss it that much.&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s dig into why.&lt;/p&gt;</description></item><item><title>Goodbye .csproj, Hello go.mod</title><link>https://stepinto.dev/posts/dotnet-to-go-modules/</link><pubDate>Sat, 28 Dec 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-modules/</guid><description>&lt;p&gt;Right, let&amp;rsquo;s talk about dependencies. In .NET land, we&amp;rsquo;ve got NuGet, &lt;code&gt;.csproj&lt;/code&gt; files, &lt;code&gt;PackageReference&lt;/code&gt; elements, version ranges, transitive dependencies, and &lt;code&gt;packages.lock.json&lt;/code&gt; if we&amp;rsquo;re being careful. It&amp;rsquo;s a mature ecosystem with excellent tooling.&lt;/p&gt;&#10;&lt;p&gt;Go does things differently. There&amp;rsquo;s no NuGet. There&amp;rsquo;s no package registry at all, actually. And that sounds mental until you understand why. It works rather well.&lt;/p&gt;&#10;&lt;h2 id="the-gomod-file" id="the-gomod-file"&gt;The go.mod File&lt;a href="#the-gomod-file" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;Every Go module has a &lt;code&gt;go.mod&lt;/code&gt; file at its root. Here&amp;rsquo;s a real one:&lt;/p&gt;</description></item><item><title>The Phrasebook: C# Concepts in Go Terms</title><link>https://stepinto.dev/posts/dotnet-to-go-phrasebook/</link><pubDate>Sat, 28 Dec 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-phrasebook/</guid><description>&lt;p&gt;Before we get into the weeds of types and patterns, let&amp;rsquo;s establish some vocabulary. Go uses different names for familiar concepts, and has operators you&amp;rsquo;ve never seen. This post is a reference. Skim it now, bookmark it for later.&lt;/p&gt;&#10;&lt;h2 id="the-terminology-swap" id="the-terminology-swap"&gt;The Terminology Swap&lt;a href="#the-terminology-swap" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;Your C# brain thinks in certain words. Here&amp;rsquo;s the translation:&lt;/p&gt;&#10;&lt;table&gt;&#10;&#9;&lt;thead&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;C# Term&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Go Term&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Notes&lt;/th&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/thead&gt;&#10;&#9;&lt;tbody&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;List&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;slice&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Dynamic array, the workhorse collection&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;T[]&lt;/code&gt; (array)&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;slice (usually)&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Go has arrays, but you&amp;rsquo;ll rarely use them&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;Dictionary&amp;lt;K,V&amp;gt;&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;map&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;map[string]int&lt;/code&gt; instead of &lt;code&gt;Dictionary&amp;lt;string, int&amp;gt;&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;namespace&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;package&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;But packages are directories, not hierarchies&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;null&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;nil&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Same concept, different spelling&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;class&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;struct&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;No inheritance, but methods work&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;property&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;field (+ methods)&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;No get/set syntax&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;var&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;var&lt;/code&gt; or &lt;code&gt;:=&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Two ways to declare variables&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;async&lt;/code&gt;/&lt;code&gt;await&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;goroutines + channels&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Completely different model&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;exception&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;error&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Errors are values, not control flow&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;try&lt;/code&gt;/&lt;code&gt;catch&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;if err != nil&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Explicit checking, no unwinding&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;using&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;defer&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Cleanup runs at function exit&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;lock&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;sync.Mutex&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Manual lock/unlock&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;foreach&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;for range&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Single construct for iteration&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;out&lt;/code&gt;/&lt;code&gt;ref&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;pointers&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Explicit &lt;code&gt;*&lt;/code&gt; and &lt;code&gt;&amp;amp;&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;LINQ&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;nothing built-in&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Loops, or generics since 1.18&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;extension methods&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;nothing&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Define functions, not methods&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;partial class&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;nothing&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;All code in the package shares scope&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;static class&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;package-level functions&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;No class, just functions&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;h3 id="arrays-vs-slices" id="arrays-vs-slices"&gt;Arrays vs Slices&lt;a href="#arrays-vs-slices" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h3&gt;&#10;&#10;&lt;p&gt;This one catches everyone. In C#, &amp;ldquo;array&amp;rdquo; means a fixed-size, contiguous block:&lt;/p&gt;</description></item><item><title>You Know .NET, Now Meet the Go Toolchain</title><link>https://stepinto.dev/posts/dotnet-to-go-toolchain/</link><pubDate>Sat, 28 Dec 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/dotnet-to-go-toolchain/</guid><description>&lt;p&gt;After twenty-odd years writing C#, I&amp;rsquo;m learning Go. Not because .NET has failed me (it hasn&amp;rsquo;t) but because some problems want a different shape of solution. Small binaries. Fast startup. Simple deployment. The kind of thing Go does without breaking a sweat.&lt;/p&gt;&#10;&lt;p&gt;This is the first post in a series documenting that journey. Not a tutorial (the Go docs are excellent), but an honest account of where my C# muscle memory helps, where it hinders, and what makes Go feel genuinely different rather than just superficially unfamiliar.&lt;/p&gt;</description></item><item><title>Streaming LLM Responses: A Partial JSON Parser for Structured Output</title><link>https://stepinto.dev/posts/streaming-json-partial-parser/</link><pubDate>Wed, 11 Dec 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/streaming-json-partial-parser/</guid><description>&lt;p&gt;I&amp;rsquo;ve been building conversational AI features recently, and I hit an annoying problem: I want &lt;em&gt;structured&lt;/em&gt; responses from the LLM (JSON with specific fields), but I also want to &lt;em&gt;stream&lt;/em&gt; the response text to the user as it generates. These two goals don&amp;rsquo;t play nicely together.&lt;/p&gt;&#10;&lt;p&gt;When you ask an LLM to respond with structured JSON, you can&amp;rsquo;t show anything to the user until the entire response arrives and parses successfully. That&amp;rsquo;s a rubbish user experience. Users stare at a spinner for seconds while the model churns through tokens that could already be on screen.&lt;/p&gt;</description></item><item><title>The Conversational Consent Pattern: Privacy That Actually Respects Your Users</title><link>https://stepinto.dev/posts/conversational-consent-pattern/</link><pubDate>Wed, 11 Dec 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/conversational-consent-pattern/</guid><description>&lt;p&gt;I&amp;rsquo;ve been thinking a lot about privacy consent lately. Not the legal side (though that matters) but the &lt;em&gt;experience&lt;/em&gt; side. The way we currently handle consent is, frankly, insulting to users.&lt;/p&gt;&#10;&lt;p&gt;You know the drill. Land on a site, get slapped with a modal, click through seventeen toggles you don&amp;rsquo;t understand, accept something you didn&amp;rsquo;t read, and get on with your life. Nobody reads those consent forms. Nobody understands the toggles. And nobody (&lt;em&gt;nobody&lt;/em&gt;) feels like they made an informed decision.&lt;/p&gt;</description></item><item><title>The Force-Quit Crash: When Worklets Outlive Your App</title><link>https://stepinto.dev/posts/worklet-crashes-ios-force-quit/</link><pubDate>Sat, 07 Dec 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/worklet-crashes-ios-force-quit/</guid><description>&lt;p&gt;Got a crash report from TestFlight this week. The user&amp;rsquo;s feedback was two words: &amp;ldquo;Hard exit.&amp;rdquo;&lt;/p&gt;&#10;&lt;p&gt;That&amp;rsquo;s all I had to go on. No steps to reproduce, no description of what they were doing. Just a crash log with &lt;code&gt;SIGABRT&lt;/code&gt; and a stack trace pointing at&amp;hellip; everything and nothing.&lt;/p&gt;&#10;&lt;p&gt;Turns out, the user had force-quit the app from the iOS app switcher. Swiped up, gone. And my app crashed &lt;em&gt;while dying&lt;/em&gt;.&lt;/p&gt;</description></item><item><title>Seven Dollars and Twenty-Five Years: Building an Expo Plugin with AI</title><link>https://stepinto.dev/posts/seven-dollars-and-twenty-five-years/</link><pubDate>Tue, 03 Dec 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/seven-dollars-and-twenty-five-years/</guid><description>&lt;p&gt;I&amp;rsquo;m building an AI training tool for small language models that ultimately deploys on mobile. Nothing revolutionary there. It&amp;rsquo;s a natural endpoint for a lot of the SLM work happening right now. But I hit a snag: Google Sign-In on Android.&lt;/p&gt;&#10;&lt;p&gt;Specifically, I needed native Google Sign-In using Android&amp;rsquo;s modern Credential Manager API, with proper nonce support for Auth0 token exchange. Sounds niche, but it&amp;rsquo;s actually a common requirement for any serious mobile auth flow.&lt;/p&gt;</description></item><item><title>About</title><link>https://stepinto.dev/about/</link><pubDate>Mon, 02 Dec 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/about/</guid><description>&lt;h2 id="hello" id="hello"&gt;Hello&lt;a href="#hello" class="heading-anchor" aria-hidden="true"&gt;#&lt;/a&gt;&#10;&lt;/h2&gt;&#10;&#10;&lt;p&gt;I&amp;rsquo;m Andy Cross. I&amp;rsquo;ve been building software for about 25 years and I&amp;rsquo;m still excited about the craft. AI won&amp;rsquo;t kill software engineering, but it has changed it. If we do it right, we&amp;rsquo;ll make the craft better.&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;m also an entrepreneur, having founded and run tech businesses over the years. That means I occasionally write about the business side of things too: startups, product thinking, and the messy reality of turning ideas into something sustainable.&lt;/p&gt;</description></item><item><title>Building 3D Scenes Through Conversation: An MCP Server for Geographic Objects</title><link>https://stepinto.dev/posts/building-3d-scenes-with-mcp/</link><pubDate>Mon, 02 Dec 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/building-3d-scenes-with-mcp/</guid><description>&lt;p&gt;I&amp;rsquo;ve been noodling around with the Model Context Protocol lately, and I wanted to share something I&amp;rsquo;ve built that demonstrates what I think is a rather interesting pattern: how you can split responsibilities between an AI and a server in a way that plays to each of their strengths.&lt;/p&gt;&#10;&lt;p&gt;The project is a 3D scene builder. But before you start thinking about meshes, textures, and rendering pipelines, stop. This isn&amp;rsquo;t that. It&amp;rsquo;s far more minimal, and I&amp;rsquo;d argue, far more useful as a foundation.&lt;/p&gt;</description></item><item><title>Rendering Conversational 3D Scenes with Three.js and MCP</title><link>https://stepinto.dev/posts/three-js-scenes-from-conversation/</link><pubDate>Mon, 02 Dec 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/three-js-scenes-from-conversation/</guid><description>&lt;p&gt;In my &lt;a href="https://stepinto.dev/posts/building-3d-scenes-with-mcp/"&gt;previous post&lt;/a&gt;, I promised that the scene data was portable. That you could feed it to &amp;ldquo;a game engine, a GIS tool, a mapping API, whatever.&amp;rdquo; Time to make good on that.&lt;/p&gt;&#10;&lt;p&gt;This post walks through building a Three.js web viewer that consumes scene data from the MCP server in real-time. You&amp;rsquo;ll end up with a browser-based 3D view that updates live as Claude manipulates the scene through conversation.&lt;/p&gt;</description></item><item><title>The Invisible Models: Debugging 3D Rendering on iOS Physical Devices</title><link>https://stepinto.dev/posts/invisible-models-ios-3d-debugging/</link><pubDate>Sat, 30 Nov 2024 00:00:00 +0000</pubDate><guid>https://stepinto.dev/posts/invisible-models-ios-3d-debugging/</guid><description>&lt;p&gt;I spent the better part of a day staring at a blank screen on an iPhone 11. The 3D scene worked perfectly on the iOS Simulator. It worked on Android. But on an actual iOS device? Nothing. Just an empty void where my models should have been.&lt;/p&gt;&#10;&lt;p&gt;No errors. No warnings. Filament (the rendering engine) happily reported &amp;ldquo;ready&amp;rdquo;. The JavaScript console was clean. Everything was fine, except for the part where nothing was rendering.&lt;/p&gt;</description></item><item><title>Claude Hot Path</title><link>https://stepinto.dev/claude-hot-path/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://stepinto.dev/claude-hot-path/</guid><description>&lt;p&gt;The hot path to Claude is one HTTPS POST, one JSON body, and a stream of six Server-Sent Event types. Every SDK wraps that in thousands of lines, and the wrapping costs you: in cold start, in memory, and in the milliseconds between the model finishing a thought and your code acting on it. Every client on this page writes the path by hand in a single file, with no SDK, and &lt;a href="https://github.com/AndyCross/claude-hot-path"&gt;the same harness&lt;/a&gt; measures what each one adds.&lt;/p&gt;</description></item><item><title>Go for C# Developers</title><link>https://stepinto.dev/go-for-csharp-developers/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://stepinto.dev/go-for-csharp-developers/</guid><description>&lt;p&gt;Twenty-odd years of C#, then Go in production. Each post takes something you already know in .NET and shows you the Go shape of it: where it is the same, where it is different, and where your muscle memory will hurt you.&lt;/p&gt;&#10;&lt;p&gt;Read the phrasebook first. Then read the chapter that matches the problem in front of you.&lt;/p&gt;</description></item><item><title>Heater Playground</title><link>https://stepinto.dev/heater/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://stepinto.dev/heater/</guid><description>&lt;p&gt;The room on the left is a simulation with constants you choose and the model&#10;never sees. Record some logs from it, train the four-weight model from the&#10;&lt;a href="https://stepinto.dev/series/understanding-world-models/"&gt;world models series&lt;/a&gt; on them, and the&#10;chart on the right shows how well it predicts a room outside the training&#10;range, next to the hand-written guess from the &lt;a href="https://stepinto.dev/posts/world-models-101/"&gt;101 post&lt;/a&gt;.&#10;Switch to the room with a door and the model gets a private field, from the&#10;&lt;a href="https://stepinto.dev/posts/world-models-104/"&gt;104 post&lt;/a&gt;, and the chart shows it working out a door the&#10;log never mentioned.&lt;/p&gt;</description></item><item><title>Partial JSON Playground</title><link>https://stepinto.dev/partial-json/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://stepinto.dev/partial-json/</guid><description>&lt;p&gt;Paste a structured LLM response below, or use the sample. Press play to replay&#10;it a few characters at a time, or drag the slider. The right-hand side shows&#10;what &lt;a href="https://www.npmjs.com/package/fenced-json"&gt;&lt;code&gt;fenced-json&lt;/code&gt;&lt;/a&gt; makes of the&#10;text received so far: the parsed value, its state, and which field is still&#10;arriving. Everything runs in your browser.&lt;/p&gt;</description></item><item><title>Search</title><link>https://stepinto.dev/search/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://stepinto.dev/search/</guid><description>search</description></item></channel></rss>