Development Diary 03 | 10 | 2018
March 22, 2018•476 words
Misadventures in Go
- So I downloaded using the instruction on the go website, and clearly didn't pay attention to create the stuff in the directory I assigned it to. So, then I typed the 
go buildcommand and it prompted me to install go usingsudo apt get. go envto show a list of Go values- I need to set the GOPATH
 - I should probably have a rough idea of what the go environment variables are.
 - Which reminds me: I should also know what the hell the bashrc is and how it control the environment.
 - Which also reminds me: I should also understand the vimrc as well.
 - I really don't know/remember shit but thankfully my current ventures are helping me with that issue.
 - I did the basic, "Hello World" program in Go
 - It's telling me to look at How to Write Go Code before I deep dive
 - Go Commands
- build: compiles packages and dependencies
 - clean: removes object files and cached files
 - doc: show documentation for package
 - env: print Go environment info
 - bug: start a bug report
 - fix: update packages to use new APIs
- This is interesting
 
 - fmt: gofmt (reformat package sources)
 - generate: generate Go files by processing source
- Interesting
 
 - get: download and install packages and dependencies
 - install: compile and install packages and dependencies
 - list: list packages
 - run: compile and run Go program
 - test: test packages
 - tool: run specific go tool
- Interesting
 
 - version: print Go version
- Very sure I will be spamming this
 
 - vet: report likely mistakes in packages
- Quite interesting
 
 
 - Compile packages and dependencies usage:
go build [-o output] [-i] [build flags] [packages]
 - Go is very anal about organization, which is fine by me.
 - I should bookmark that page.
 - Code Organization:
- Keep everything in one single workspace
 - A workspace contains many version controls repos
 - Each repo contains one or more packages
 - Each package contains of one more go source files in a single directory
 - The path to a package's directory determines its import path
 - Different from other programming envs because every project has a separate workspace and workspaces are closely tied to version control repos.
- Basically I'm going to confuse and screw myself much like when I code in Python vs. C++ and add semicolons to Python code.
 
 - Workspace:
- src: contains Go source files
 - pkg: contains package objects
 - bin: contains executable commands
 
 
 - Upcoming To Do List:
- Continue with examples from the Go site
 - I have the K&R Go Book so I will start going through that
 - I also have the Go Web Programming Book so I will keep doing web examples in Go