Skip to content

Instantly share code, notes, and snippets.

View joseph0x45's full-sized avatar

Joseph Dogbevi joseph0x45

View GitHub Profile
@joseph0x45
joseph0x45 / index.md
Last active June 9, 2024 11:05
How I develop my Go apps in containers using Neovim and docker compose

Hello reader. I have been trying to replicate the dev container experience that I had when I was still using vscode (I use neovim now btw) but it wasn't quite that, I tried some neovim plugins but didn't really like it. But I'm happy to tell you that I finally got something, just for Golang apps, but we are getting there. Let's quickly see how I achieved this.

Required dependencies

You will need docker and docker compose installed on your system. I use Manjaro so for me installing these two was as easy as running

pamac install docker docker-compose

Once you have these two installed you will need a text editor, I will be using neovim. What I mean by the "dev container experience" is to be able to have my code on my host, but run and debug it inside a container so that way my computer doesn't have any dependencies and I can easily reproduce the dev environment on another PC without having a "it worked on that other machine" moment. As exemple we will build a simple Go app that returns "Hello world

@heyimalex
heyimalex / sqlmap.go
Last active March 7, 2025 01:50
Functions for querying directly into map[string]interface{}
// Package sqlmap provides functions for querying directly into
// map[string]interface{}.
//
// In developing really simple api endpoints, I found the boilerplate needed
// to take the results of a database query and output them as JSON to be
// really fucking annoying; make a custom struct, scan into that struct, if
// there are multiple rows do the whole rows.Next() song and dance, and if
// anything changes update the three spots each column of the result is now
// dependent on. Even when using libraries like sqlx, there's still a lot of
// extraneous code that needs to be written.
@julz
julz / main.go
Created November 20, 2015 12:39
containersched minicontainer
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
func main() {