go build & go install
review
two packages and two files from before ...
import
Notice how we import a package ...
Notice how we import a package ...
… and then use one of its public funcs.
Aliasing Imports
just for fun
Review
● go build
○ builds go code; if code is package main, it creates a binary executable and drops it in the package main’s
folder; if code is just a package, it builds it then throws away the binary.
● go install
○ builds and installs go code; if code is package main, it creates a binary executable and drops it in the
workspace’s bin folder; if code is a package, it builds it then drops it in the pkg folder (a file with a .a
extension)
● import
○ import path is everything after the “src” folder in your workspace
○ use the last folder in the import path to reference the package in your code
○ you can alias packages in your imports
Review Questions
import
● Search for uuid at godoc.org
● use go get to get the code for nu7hatch/gouuid
● open up finder
● locate this code
○ take a screenshot of this
● Create a file that imports this code
● alias the package as just uuid
○ take a screenshot of this