A selective tour of Go by example, with emphasis on concurrent programming.
Concepts covered:
- Variable declaration/assignment
- Range looping
- Panic
- Defer
- Shared memory space signaling (work group, channel)
- Go-routines
This code implements the following simulated data pipeline:
go build -o app
- Start the server:
./app
- Make sure netcat is installed
- Send sample TCP packets:
for ((x=0; x<10; x++)); do echo -e "$x" | netcat localhost 8080 -c && sleep 1; done