Skip to content

Instantly share code, notes, and snippets.

@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"
@asukakenji
asukakenji / 0-go-os-arch.md
Last active November 26, 2024 03:31
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
@jfellus
jfellus / README.md
Last active September 26, 2024 21:55
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

@maratori
maratori / golang-mocks.md
Last active November 27, 2024 20:30
Comparison of golang mocking libraries

Comparison of golang mocking libraries

Updated 2024-09-01

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

Library

GitHub stars [![s1]][1] [![s2]][2] + [![s3]][3] [![s4]][4] [![s5]][5] [![s6]][6]
Latest release date [![d1]][r1] [![d2]][r2] + [![d3]][r3] [![d4]][r4] [![d5]][r5] [![d6]][r6]
Maintained
@candlerb
candlerb / go-project-layout.md
Last active October 1, 2024 08:33
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: