Skip to content

Instantly share code, notes, and snippets.

View zboya's full-sized avatar

zboya zboya

View GitHub Profile
@zboya
zboya / go-os-arch.md
Created October 10, 2018 10:30 — forked from asukakenji/0-go-os-arch.md
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

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

A list of valid GOOS values

(Bold = supported by go out of the box, ie. without the help of a C compiler, etc.)

  • android
  • darwin
@zboya
zboya / sliceUiq.go
Created August 23, 2018 03:55
golang remove duplicates in a slice
func SliceUniqMap(s []int) []int {
seen := make(map[int]struct{}, len(s))
j := 0
for _, v := range s {
if _, ok := seen[v]; ok {
continue
}
seen[v] = struct{}{}
s[j] = v
j++
@zboya
zboya / gettcpinfo_test.go
Last active May 30, 2018 08:35
get tcp info by golang
package gettcpinfo
import (
"io"
"log"
"net"
"runtime"
"testing"
"golang.org/x/sys/unix"