Logo Dan Gillis
    Logo Inverted Logo
    • Posts
    • REST API Error Handling in Go - Part 2
    • oplint
    • Low-Dependency Database Migrations and Integration
    • Logging in go-api-basic
    • Emerging from my Gopher Hole
    • REST API Error Handling in Go
    • Jekyll to Hugo Conversion
    • Archive
      • HTTP Logging and Go API Template Updates
      • Basic Redis Examples with Go
      • Containerizing a Go API with Docker For Mac
      • HTTP JSON Error Responses in Go
      • Drums - King Crimson Red Live @ Great Scott
      • Go API Template v0.0.2
      • Go
      • Drums - Frankenstein Practice
      • OS X Oracle + Node setup
      • Drums - Raju Live
      • Apex 5 - Minimize Left Sidebar
      • Raiser
      • Node Oracle Glory
        • Volume 3
        • Volume 2
        • Volume 1
      • Name:Value Encryption Utility using PL/SQL
    Hero Image
    REST API Error Handling in Go - Part 2

    I have recently updated the way I handle errors in Go. In some ways, I’ve come full circle back to where I started, in others, I think I’ve evolved. When I initially wrote my errors post in June of 2021, I had come up with a hybrid of Rob Pike’s upspin errors and Dave Cheney’s https://github.com/pkg/errors package. This hybrid works well, however, in December 2021 https://github.com/pkg/errors was archived and, generally, the Go community seems to have opted for a simpler option of adding proper error context and wrapping errors.

    February 6, 2023 Read
    Hero Image
    oplint: The op linter

    I made a new linter called oplint! This was a really fun thing to do as I had never ventured into static analysis before. I created this tool to help me understand where an error originates without using the pkg/errors error stack functionality. The pkg/errors project has been archived and it seems the Go community has largely moved on to just wrapping errors using the standard library. I am moving away from using pkg/errors to use only the standard library as well, and am trying to make sure I can trace an error source in a standardized way.

    January 11, 2023 Read
    Hero Image
    Low-Dependency Database Migrations and Integration

    A few weeks ago, I gave a presentation to the Boston Go Meetup on Low-Dependency Database Migrations and Integration, in which I discuss how I handle database migrations and database integration in the go-api-basic project that I’ve been working on. In the presentation I mention several tools that I use, so I wanted to add links to them here. Mage PostgreSQL JetBrains DataGrip sqlc The video for the talk is below:

    March 15, 2022 Read
    Hero Image
    Logging in go-api-basic

    Thoughts on Logging I’ve gone through a few logging phases in my career. I logged everything. It was great, until the logs became meaningless because there were too many. I logged only errors, but in some cases that was not enough. Now I’m somewhere in the middle. I do believe in logging all errors and detailed how I do that in my last post. There are also times when it’s helpful to have some debugging logs in place.

    July 13, 2021 Read
    Hero Image
    REST API Error Handling in Go

    Handling errors is really important in Go. Errors are first class citizens and there are many different approaches for handling them. Initially I started off basing my error handling almost entirely on a blog post from Rob Pike and created a carve-out from his code to meet my needs. It served me well for a long time, but found over time I wanted a way to easily get a stacktrace of the error, which led me to Dave Cheney’s https://github.

    June 21, 2021 Read
    Hero Image
    Emerging from my Gopher Hole

    Inspiration I was inspired recently after listening to Go Time FM episode #167 and Johnny Boursiquot’s callout: “If you are out there, and I’m speaking to you listener, or watcher, if you are out there and thinking/meaning to muster up the energy or overcome the imposter syndrome to write a blog post that’s beginner, but you’re thinking “Oh man, everyone’s already written a beginner blog post on this thing, my voice doesn’t really matter I’m not going to really add anything to that” - you need to get over that.

    June 21, 2021 Read
    Hero Image
    Jekyll to Hugo Conversion

    Today I converted my old posts from jekyll to HUGO and archived them for posterity. It’s fun to look back at some of those posts now – so much has changed for me… My new site is going to start minimalist, and I’ll add to it over time. I’m using the Toha theme, which has great guides

    May 27, 2021 Read
    Hero Image
    HTTP Logging and Go API Template Updates

    I built my first Go library! httplog provides middleware which logs http requests and responses along with a few other features I find useful. I thought it might be helpful for some. At the very least, I tried to document the library reasonably well, spending a lot of time developing the README and ensuring the GoDoc was in good shape. I learned a lot through this exercise. I also restructured my Go API template repository to try and shape it based on Mat Ryer’s fantastic “How I write Go HTTP services after seven years” post.

    October 13, 2018 Read
    Hero Image
    Basic Redis Examples with Go

    Redis is pretty great. It is the #1 most loved database for the second year in a row, according to a recent Stack Overflow survey. I decided it was high time I taught myself how to use it with Go. There are a number of libraries in the Go ecosystem for Redis, but the two most popular are go-redis and redigo. Each library has a decent amount of stars, contributors, etc.

    July 17, 2018 Read
    Hero Image
    Containerizing a Go API with Docker For Mac

    I’m working through creating a RESTful API template. As part of it, I want to be able to “Containerize” my app using docker and deploy it to “the cloud”. Baby steps for me though — I want to get everything working locally first. This post is about “containerizing” my API using Docker and getting it to work locally on my Mac. Right now, from a networking perspective, my app is pretty simple — it needs connectivity on two ports: 1 port for database traffic, 1 port for http traffic.

    April 6, 2018 Read
    Hero Image
    HTTP JSON Error Responses in Go

    I like simple structured messages using JSON in error responses, similar to Stripe, Uber and many others… { "error": { "type": "validation_failed", "message": "Username is a required field" } } In my last story, I wrote about HTTP Logging and in that I mentioned that I have used “chained” middleware using the Adapter pattern from Mat Ryer’s excellent post. You’ll see that below, but also in addition, I’m wrapping my final true app handler (in this case, CreateUser) inside an ErrHandler type — eh.

    March 18, 2018 Read
    Hero Image
    Drums: King Crimson Red Live @ Great Scott

    Fun show a couple nights ago @ Great Scott in Allston. Cover of King Crimson’s Red… King Crimson Cover - Red

    March 14, 2018 Read
    • ««
    • «
    • 1
    • 2
    • »
    • »»
    Navigation
    • About
    • Recent Posts
    Contact me:
    • dan@dangillis.dev

    Toha Theme Logo Toha
    © 2023 Copyright.
    Powered by Hugo Logo