<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hamsavarthan</title>
    <description>The latest articles on DEV Community by Hamsavarthan (@hamsavarthan_0).</description>
    <link>https://dev.to/hamsavarthan_0</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4108430%2Fff0150b4-db1d-4a42-aca3-d0c92625d0f4.png</url>
      <title>DEV Community: Hamsavarthan</title>
      <link>https://dev.to/hamsavarthan_0</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hamsavarthan_0"/>
    <language>en</language>
    <item>
      <title>The Standard Library Was Already Enough: Rebuilding Taskfile in Pure Go</title>
      <dc:creator>Hamsavarthan</dc:creator>
      <pubDate>Thu, 03 Sep 2026 16:49:54 +0000</pubDate>
      <link>https://dev.to/hamsavarthan_0/the-standard-library-was-already-enough-rebuilding-taskfile-in-pure-go-2ome</link>
      <guid>https://dev.to/hamsavarthan_0/the-standard-library-was-already-enough-rebuilding-taskfile-in-pure-go-2ome</guid>
      <description>&lt;p&gt;&lt;strong&gt;What I built:&lt;/strong&gt; &lt;code&gt;raptor&lt;/code&gt;, a zero-dependency task runner for a common subset of &lt;code&gt;go-task/task&lt;/code&gt;. One binary. Blank &lt;code&gt;go.mod&lt;/code&gt;. 24 standard library substitutions. Built for Zero Dependency 2026.&lt;/p&gt;

&lt;p&gt;Repository:&lt;a href="https://github.com/hamsavartn/raptor" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  1. What I Reimplemented
&lt;/h2&gt;

&lt;p&gt;The honest headline: &lt;strong&gt;I replaced a Go tool that itself replaces &lt;code&gt;make&lt;/code&gt; — and did it with an empty &lt;code&gt;go.mod&lt;/code&gt; (zero third-party imports).&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;go-task/task&lt;/code&gt; is a popular, cross-platform, YAML-driven task runner. In its dependency tree, you will find &lt;code&gt;gopkg.in/yaml.v3&lt;/code&gt; and &lt;code&gt;github.com/mvdan/sh&lt;/code&gt; (an entire shell interpreter written in Go). I wanted to understand what those packages actually buy you — and rebuild that machinery with only Go standard library primitives:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Indentation-sensitive parser:&lt;/strong&gt; Hand-written state machine for the Taskfile subset with line:column error reporting.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DAG dependency scheduler:&lt;/strong&gt; Depth-first search for topological sort and cycle detection.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bounded parallel execution:&lt;/strong&gt; Channel-based semaphores scaling to &lt;code&gt;runtime.NumCPU()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Incremental builds:&lt;/strong&gt; &lt;code&gt;sources&lt;/code&gt;/&lt;code&gt;generates&lt;/code&gt; tracking using timestamp and &lt;code&gt;crypto/sha256&lt;/code&gt; content hashing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic variables &amp;amp; templating:&lt;/strong&gt; Evaluating &lt;code&gt;{ sh: cmd }&lt;/code&gt; once per run, plus &lt;code&gt;{{.KEY | upper}}&lt;/code&gt; template functions and &lt;code&gt;for:&lt;/code&gt; loops.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deterministic output modes:&lt;/strong&gt; Interleaved live streaming, prefixed lines, and topological group output.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. What the Standard Library Made Painfully Obvious
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;YAML is deceptively large, and Go's stdlib has none of it.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
That was the biggest lesson. Go ships with &lt;code&gt;encoding/json&lt;/code&gt;, but zero YAML support. Within an hour, "writing a small YAML parser" turned into "writing a strict parser for a subset of YAML that fails loudly on invalid syntax." Indentation isn't formatting — it is syntax. A tab changes semantic meaning. A &lt;code&gt;#&lt;/code&gt; inside quotes is text, not a comment. A &lt;code&gt;:&lt;/code&gt; in a URL isn't a key delimiter. Writing this parser taught me why developers import &lt;code&gt;yaml.v3&lt;/code&gt; without thinking twice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The stdlib has no recursive `&lt;/strong&gt;&lt;code&gt;-glob.**  &lt;br&gt;
&lt;/code&gt;filepath.Glob&lt;code&gt; handles flat &lt;/code&gt;&lt;em&gt;&lt;code&gt;, but not recursive path matching (&lt;/code&gt;&lt;/em&gt;&lt;em&gt;/&lt;/em&gt;.go`). Hand-rolling a segment-by-segment recursive matcher was subtle — getting it wrong causes incremental builds to silently fall back to rebuilding everything.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Content hashing over timestamps.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
File modification times (&lt;code&gt;mtime&lt;/code&gt;) fail when developers switch git branches or restore older commits. Implementing true content-based incremental caching meant piping source files into &lt;code&gt;crypto/sha256&lt;/code&gt; to record deterministic &lt;code&gt;.checksum&lt;/code&gt; states.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. The Edge Case That Ate an Afternoon: Concurrency Log Tearing
&lt;/h2&gt;

&lt;p&gt;When 5 tasks run concurrently and write to &lt;code&gt;os.Stdout&lt;/code&gt;, terminal logs tear and scramble unpredictably. &lt;/p&gt;

&lt;p&gt;My initial thought was to buffer each task's stdout in a memory buffer and flush it upon completion. But if a task streams a multi-gigabyte build artifact, memory blows up. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The fix:&lt;/strong&gt; Designing an opt-in deterministic output engine (&lt;code&gt;--ordered-output&lt;/code&gt;) that spools concurrent task streams to OS temp files (&lt;code&gt;os.CreateTemp&lt;/code&gt;), and re-emits them strictly in topological DAG order. The lesson wasn't about clever data structures — it was deciding how to manage resources cleanly under concurrency.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. The 24-Substitution Architecture
&lt;/h2&gt;

&lt;p&gt;We documented every single standard library replacement in &lt;code&gt;STDLIB.md&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;gopkg.in/yaml.v3&lt;/code&gt; ➔ Hand-written indentation tokenizer (&lt;code&gt;bufio.Scanner&lt;/code&gt; + &lt;code&gt;bytes.Buffer&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;spf13/cobra&lt;/code&gt; ➔ &lt;code&gt;flag.FlagSet&lt;/code&gt; with custom dispatch&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;golang.org/x/sync/errgroup&lt;/code&gt; ➔ Channel semaphore &lt;code&gt;make(chan struct{}, jobs)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;bmatcuk/doublestar&lt;/code&gt; ➔ Recursive segment matcher on &lt;code&gt;filepath.Match&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;mvdan/sh&lt;/code&gt; ➔ Native shell dispatch (&lt;code&gt;cmd.exe /c&lt;/code&gt; on Windows, &lt;code&gt;sh -c&lt;/code&gt; on Unix)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;One command to compile (&lt;code&gt;go build .&lt;/code&gt;), zero dependencies to audit, and byte-for-byte reproducible. The Go standard library is vastly more capable than most modern dependency trees give it credit for.&lt;/p&gt;

</description>
      <category>go</category>
      <category>programming</category>
      <category>opensource</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
