/go-systems-programming

Go Systems Programming examples

Primary LanguageGo

Go Systems Programming

From the Go Systems Programming book, and my book notes.

Examples

Basic Go Features

  1. Commandline Param -i
  2. Illustrative Functions
  3. Deferred Functions
  4. Pointer Basics
  5. Converting an Array to a Map
  6. Data Structures
  7. Interface / Duck Typing
  8. Random Numbers
  9. Add Commandline Args

Advanced Go Features

  1. Function Error Handling
  2. Logging
  3. Add Commandline Args (Improved!)
  4. Regular Expressions
  5. Read Column in Data
  6. Column Summary
  7. Occurrences
  8. Find and Replace
  9. Reflection
  10. Unreachable Code
    • go tool vet unreachable.go

Packages, Algorithms & Data Structures

  1. Sorting Slices
  2. Runtime
  3. A Simple Package
    • go install aSimplePackage
  4. Using A Simple Package
  5. Using The MySQL Package
    • go get github.com/go-sql-driver/mysql
  6. Garbage Collection

Files and Directories

  1. Using Command-Line Flags
    • go run usingFlag.go -o -c -k 5
  2. Symbolic Links
    • go run symbLink.go /etc
  3. pwd(1)
    • go run pwd.go -P
  4. which(1)
    • go run which.go ls to show the first
    • go run which.go -a ls to show all
    • go run which.go -s ls && echo $? to print the exit code
    • go run which.go -s butts && echo $? to print the exit code
  5. permissions
    • go run permissions.go ~
  6. rm
    • go run rm.go 123