- [30m] ☀️ Warm Up
- [15m] 💻 Activity: Review, Reflect, Resubmit
- [10m] 🌴 Break
- [20m] 📖 Overview: Intro to Using 3rd Party Libs
- [25m] 💻 Activity: Add Modules Support to Your SSG
- 📚 Resources & Credits
Level | Verbs |
---|---|
6: Create | design, formulate, build, invent, create, compose, generate, derive, modify, develop |
5: Evaluate | choose, support, relate, determine, defend, compare, contrast, justify, support, convince, select |
4: Analyze | classify, break down, categorize, analyze, diagram, illustrate, criticize, simplify, associate |
3: Apply | calculate, predict, apply, solve, illustrate, use, demonstrate, determine, model, perform, present |
2: Understand | describe, explain, paraphrase, restate, summarize, contrast, interpret, discuss |
1: Remember | list, recite, outline, define, name, match, quote, recall, identify, label, recognize |
Complete Structs & While Loops warmup.
It's time to breakout into teams of 3 and review each other's solutions.
When you enter the breakout room, be sure to share your screen with each other to pair program / get help.
If you fix your solution, you can resubmit it for grading by the end of the class period!
Workspace: A directory on your system where Go looks for source code files, manages dependency packages and build distribution binary files. Whenever a Go program encounters an import statement, it looks for the package in the Go's standard library's src
directory, located in $GOROOT
.
Package: A directory inside your Go workspace containing one or more Go source files, or other Go packages. Every Go source file belongs to a package. To declare a source file to be part of a package, we use the following syntax:
package <package_name>
Module: A collection of Go packages stored in a file tree with a go. mod file at its root. The go.mod
file defines the module's module path, which is also the import path used for the root directory, and its dependency requirements, which are the other modules needed for a successful build.
Run go env
on your system now.
Find the following environment variables and write down their values:
GOROOT
GO111MODULE
GOPATH
To initialize our project to use modules:
go mod init github.com/GITHUB_USERNAME/GITHUB_REPO_NAME
NOTE: The GitHub repository does not have to exist yet. Discuss why.
go mod download <package_url>
- It's common to add the
vendor/
directory to your.gitignore
file. gitignore.io's base.gitignore
file for Golang is as follows:
# Created by https://www.gitignore.io/api/go
# Edit at https://www.gitignore.io/?templates=go
### Go ###
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
# vendor/
### Go Patch ###
/vendor/
/Godeps/
# End of https://www.gitignore.io/api/go
- https://pkg.go.dev provides:
- Centralized information for Go packages and modules published on index.golang.org.
- Essential learning resources
- Critical use cases & case studies
- https://github.com/topics/go: GitHub Topics for Golang
- https://search.gocenter.io: Quickly searchable index of packages
- https://twitter.com/RealGophersShip: Twitter bot that highlights Golang package releases.
Complete the first requirement in the v1.2 Checklist by adding Go Modules support to your project. Use this tutorial as a guide.