Go examples making use of the gopacket / pcap libraries...
Source: http://www.devdungeon.com/content/packet-capture-injection-and-analysis-gopacket
go get github.com/google/gopacket
sudo apt-get install libpcap-dev
# turn promiscuous mode on
sudo ifconfig eth0 promisc up