<?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: Collins Kipruto</title>
    <description>The latest articles on DEV Community by Collins Kipruto (@collo006).</description>
    <link>https://dev.to/collo006</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%2F3965939%2Fda206f1a-8660-487b-b104-99ad393f2d6e.jpeg</url>
      <title>DEV Community: Collins Kipruto</title>
      <link>https://dev.to/collo006</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/collo006"/>
    <language>en</language>
    <item>
      <title>Building a Go Payment API Library From Scratch</title>
      <dc:creator>Collins Kipruto</dc:creator>
      <pubDate>Thu, 09 Jul 2026 13:03:30 +0000</pubDate>
      <link>https://dev.to/collo006/what-i-learned-building-a-go-payment-api-library-from-scratch-1chi</link>
      <guid>https://dev.to/collo006/what-i-learned-building-a-go-payment-api-library-from-scratch-1chi</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8yt38zuxi7qsy3nom4an.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8yt38zuxi7qsy3nom4an.png" alt=" " width="800" height="414"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  description:
&lt;/h1&gt;

&lt;p&gt;Insights on pointers, methods, resource management, and HTTP clients while building an open-source Go library.&lt;/p&gt;

&lt;h1&gt;
  
  
  tags:
&lt;/h1&gt;

&lt;p&gt;golang, backend, webdev, learning&lt;/p&gt;

&lt;p&gt;A few days ago, a couple of friends and I decided to take a detour from our usual routines to build something practical: a &lt;strong&gt;Go library for payment APIs&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;The goal is simple. Instead of every Go developer writing custom, repetitive code to integrate payment gateways, they can just import our open-source library straight from GitHub. &lt;/p&gt;

&lt;p&gt;Building a library forces you to think deeply about architecture, developer experience, and language fundamentals. Here is everything this project has taught me so far.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Client Structure and a Sharper Grip on Pointers
&lt;/h2&gt;

&lt;p&gt;Setting up the base client structure required a lot of intentional data modeling. In doing so, I gained a much clearer understanding of &lt;strong&gt;pointers&lt;/strong&gt; in Go. Deciding when to pass a struct by value versus passing a pointer to mutating states is a critical choice when designing an API client that other developers will rely on.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Deconstructing the Authentication Flow
&lt;/h2&gt;

&lt;p&gt;Implementing authentication gave me a front-row seat to the full request-response lifecycle. I broke down the exact steps needed to establish a secure connection:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;URL Construction:&lt;/strong&gt; Building clean, dynamic endpoints.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Request Creation:&lt;/strong&gt; Preparing payloads and setting secure headers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Validation:&lt;/strong&gt; Verifying our data before it leaves the application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transmission &amp;amp; Response:&lt;/strong&gt; Sending the request to the admin server and handling the incoming payload cleanly.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  3. Functions vs. Methods: The Concrete Difference
&lt;/h2&gt;

&lt;p&gt;While the terms are often used interchangeably in other languages, Go draws a distinct line between functions and methods. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A Function&lt;/strong&gt; is a standalone block of code used to execute a program routine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A Method&lt;/strong&gt; is simply a function that contains a &lt;strong&gt;receiver&lt;/strong&gt;, meaning it belongs to a specific type.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// This is a standalone function&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;ClearCache&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;// logic here&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;// This is a method belonging to the 'User' struct type&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;u&lt;/span&gt; &lt;span class="o"&gt;*&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;DeactivateAccount&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;// logic here&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Resource Management: Why You Must &lt;code&gt;defer Body.Close()&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;One of the biggest gotchas for newer Go developers is resource leakage via HTTP responses. When you make a network request, the server keeps the connection open until you explicitly close it. &lt;/p&gt;

&lt;p&gt;Using &lt;code&gt;defer response.Body.Close()&lt;/code&gt; right after checking for errors is mandatory. &lt;/p&gt;

&lt;p&gt;Think of it like borrowing a book from a library. If you keep borrowing books and never return them, your state keeps looping on "borrowing." Eventually, the library runs out of space, and you cannot borrow anymore. In Go, failing to close the body will cause your application to run out of memory and file descriptors.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Staying Flexible with &lt;code&gt;http.Client.Do()&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;When interacting with different payment endpoints, you encounter various HTTP verbs like &lt;code&gt;POST&lt;/code&gt;, &lt;code&gt;GET&lt;/code&gt;, &lt;code&gt;PUT&lt;/code&gt;, and &lt;code&gt;DELETE&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;Instead of wrapping our client in strict, specialized helpers, we relied on Go's native &lt;code&gt;http.Client.Do()&lt;/code&gt; method. Because &lt;code&gt;.Do()&lt;/code&gt; accepts a completely custom &lt;code&gt;*http.Request&lt;/code&gt; object, it accommodates any HTTP method seamlessly. If an upstream payment provider suddenly changes a route from a &lt;code&gt;POST&lt;/code&gt; to a &lt;code&gt;PUT&lt;/code&gt;, our underlying architecture remains intact and resilient.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;This project is turning out to be an amazing engineering journey. By building this library, I am moving past just "using" payment APIs to truly understanding how they function under the hood. &lt;/p&gt;

&lt;p&gt;I'll be sharing more updates as my team moves closer to our alpha release. If you have any tips on building clean SDKs in Go, let me know in the comments below!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>What I Learned Building My First Go Project (go-reloaded)</title>
      <dc:creator>Collins Kipruto</dc:creator>
      <pubDate>Wed, 17 Jun 2026 09:42:25 +0000</pubDate>
      <link>https://dev.to/collo006/what-i-learned-building-my-first-go-project-go-reloaded-26k8</link>
      <guid>https://dev.to/collo006/what-i-learned-building-my-first-go-project-go-reloaded-26k8</guid>
      <description>&lt;p&gt;During my first week at Zone01 Kisumu, I worked on a project called &lt;strong&gt;go-reloaded&lt;/strong&gt;. It was my first real hands-on experience using Go, and it helped me understand not just the language, but also how to think like a developer.&lt;/p&gt;

&lt;p&gt;In this article, I’ll share what I learned, the challenges I faced, and the key concepts that made everything click.&lt;/p&gt;

&lt;p&gt;What the Project Was About&lt;/p&gt;

&lt;p&gt;The goal of the project was to build a small Go program that works with command-line arguments and processes input using Go’s standard libraries.&lt;/p&gt;

&lt;p&gt;This was my first time interacting deeply with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;os package&lt;/li&gt;
&lt;li&gt;command-line arguments (os.Args)&lt;/li&gt;
&lt;li&gt;basic Go program structure&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At first, it felt confusing, but step by step, things started to make sense.&lt;/p&gt;

&lt;p&gt;What I Learned&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;How command-line arguments work in Go
I learned that Go provides access to raw input from the terminal using:
os.Args&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This returns a slice of strings where:&lt;br&gt;
os.Args[0] is the program name&lt;br&gt;
os.Args[1:] are the actual inputs&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Working with the &lt;code&gt;os&lt;/code&gt; package
The &lt;code&gt;os&lt;/code&gt; package became one of the most important parts of the project.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I used it to:&lt;br&gt;
Read input arguments&lt;br&gt;
Handle program execution flow&lt;br&gt;
Understand how programs interact with the system&lt;/p&gt;

&lt;p&gt;This helped me realize that Go is very close to the system level compared to JavaScript.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Breaking problems into smaller steps
One of the biggest lessons wasn’t about code—it was about thinking.
Instead of trying to solve everything at once, I learned to:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Understand the problem first&lt;br&gt;
Break it into smaller tasks&lt;br&gt;
Solve each part step by step&lt;/p&gt;

&lt;p&gt;This made debugging much easier.&lt;/p&gt;

&lt;p&gt;Challenges I Faced&lt;/p&gt;

&lt;p&gt;At the beginning, I struggled with:&lt;/p&gt;

&lt;p&gt;Understanding how &lt;code&gt;os.Args&lt;/code&gt; works&lt;br&gt;
Knowing where to start in the code&lt;br&gt;
Handling errors when inputs were missing&lt;/p&gt;

&lt;p&gt;Sometimes I would get stuck just trying to figure out what the program was actually receiving.&lt;/p&gt;

&lt;p&gt;But debugging helped me a lot. Printing values at each step made things clearer.&lt;/p&gt;

&lt;p&gt;Key Takeaways&lt;/p&gt;

&lt;p&gt;Go is very explicit compared to JavaScript&lt;br&gt;
The &lt;code&gt;os&lt;/code&gt; package is powerful for system-level interaction&lt;br&gt;
Command-line arguments are simple but very useful&lt;br&gt;
Problem-solving is more important than syntax&lt;br&gt;
Debugging is part of learning, not a failure&lt;/p&gt;

&lt;p&gt;Final Thoughts&lt;/p&gt;

&lt;p&gt;This project was a big step in my learning journey. It helped me understand how Go works and how to approach programming problems more effectively.&lt;/p&gt;

&lt;p&gt;I’m still learning, but each project is making things clearer.&lt;/p&gt;

&lt;p&gt;Next, I’m looking forward to building more complex projects and improving my backend and DevOps skills.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>cli</category>
      <category>go</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
