Skip to content

Instantly share code, notes, and snippets.

@birowo
birowo / graphql-go-mongodb-example.go
Created October 24, 2018 02:17 — forked from trunet/graphql-go-mongodb-example.go
Minimal example of GraphQL Golang and MongoDB playing nicely together. Edit
// Embedded in this article https://medium.com/p/c98e491015b6
package main
import (
"context"
"fmt"
"log"
"net/http"
"time"
@birowo
birowo / main_1.go
Created October 18, 2018 07:40 — forked from pseudomuto/main_1.go
Blog Code: Clean SQL Transactions in Golang
package main
import (
"database/sql"
"log"
)
func main() {
db, err := sql.Open("VENDOR_HERE", "YOUR_DSN_HERE")
handleError(err)
@birowo
birowo / dep.md
Created September 28, 2018 05:47 — forked from subfuzion/dep.md
Concise guide to golang/dep

Overview

This gist is based on the information available at golang/dep, only slightly more terse and annotated with a few notes and links primarily for my own personal benefit. It's public in case this information is helpful to anyone else as well.

I initially advocated Glide for my team and then, more recently, vndr. I've also taken the approach of exerting direct control over what goes into vendor/ in my Dockerfiles, and also work from isolated GOPATH environments on my system per project to ensure that dependencies are explicitly found under vendor/.

At the end of the day, vendoring (and committing vendor/) is about being in control of your dependencies and being able to achieve reproducible builds. While you can achieve this manually, things that are nice to have in a vendoring tool include:

@birowo
birowo / introrx.md
Created September 12, 2018 02:56 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@birowo
birowo / index.html
Created July 9, 2018 02:14
SuSo - the happy sudoku solver — live at https://zenmumbler.net/suso/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>SuSo</title>
<style>
content {
display: flex;
justify-content: flex-start;
align-items: flex-start;
@birowo
birowo / _.sh
Created May 9, 2018 05:45 — forked from ikennaokpala/_.sh
Starting up and Monitoring a Golang binary in production
# Make it executable
sudo chmod +x etc/init.d/myapp
# Try it:
sudo service myapp start
# Make it run upon boot:
sudo update-rc.d myapp defaults
// Copyright 2016 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// Command caption reads an audio file and outputs the transcript for it.
package main
import (
"fmt"
"io"
@birowo
birowo / Twelve_Go_Best_Practices.md
Created January 22, 2018 05:39 — forked from pzurek/Twelve_Go_Best_Practices.md
Twelve Go Best Practices
@birowo
birowo / main.go
Created January 15, 2018 13:51 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@birowo
birowo / 1_simple.go
Created December 29, 2017 16:15 — forked from sosedoff/1_simple.go
Golang Custom Struct Tags Example
package main
import (
"fmt"
"reflect"
)
// Name of the struct tag used in examples
const tagName = "validate"