Skip to content

Instantly share code, notes, and snippets.

@candlerb
candlerb / go-project-layout.md
Last active April 24, 2024 19:22
Suggestions for go project layout

If someone asked me the question "what layout should I use for my Go code repository?", I'd start by asking back "what are you building: an executable, or a library?"

Single executable

Stage 1: single source file

Create a directory named however you want your final executable to be called (e.g. "mycommand"), change into that directory, and create the following files:

@maratori
maratori / golang-mocks.md
Last active April 24, 2024 07:56
Comparison of golang mocking libraries

Comparison of golang mocking libraries

Updated 2024-04-21

Uber
[gomock][6]
[testify][2] + [mockery][3] [minimock][4] [moq][5] Google
[gomock][1]

Library

GitHub stars [![s6]][6] [![s2]][2] + [![s3]][3] [![s4]][4] [![s5]][5] [![s1]][1]
Latest release date [![d6]][r6] [![d2]][r2] + [![d3]][r3] [![d4]][r4] [![d5]][r5] [![d1]][r1]
Maintained :white_check
@jfellus
jfellus / README.md
Last active September 21, 2023 07:14
Docker-compose (v2,v3) | Network interfaces order is tied to docker network names lexical order despite priority

Docker-compose network priority won't work, would it be v2 or v3

Deterministic docker-network to container interface is a must in multi-network setups Docker-compose has a priority mechanism to let the containers connect in order to the given networks

However, docker itself doesn't seem to take that into account

Instead, ethX order in the containers is determined by the lexical order of network names

How to reproduce

@asukakenji
asukakenji / 0-go-os-arch.md
Last active April 24, 2024 06:51
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@jezell
jezell / kubernetes-websocket.go
Created September 25, 2016 08:04
Connect to Kubernetes endpoint over websockets
package main
import (
"bytes"
"flag"
"golang.org/x/net/websocket"
"io"
"k8s.io/client-go/1.4/rest"
"k8s.io/client-go/1.4/tools/clientcmd"
"log"