W3Tutorials.net
Toggle Menu
Home
Online Go Compiler
Tutorials
Javascript Tutorials
Python Tutorials
Go Tutorials
Blog
All Posts
Go Modules and Dependency Management
Quiz yourself on Go modules,versioning,and package management.
1. Which command initializes a new Go module?
go mod init
go mod start
go init mod
go create mod
2. What is the primary purpose of the 'go mod tidy' command?
Only removes unused dependencies
Only adds missing dependencies
Updates go.mod and go.sum by adding missing and removing unused dependencies
Downloads all dependencies to the local cache
3. Which file records cryptographic hashes to verify dependency integrity?
go.mod
go.sum
go.dep
go.lock
4. Which commands manage Go module dependencies? (Select all that apply)
go mod download
go mod vendor
go get
go build
5. When is a dependency marked 'indirect' in go.mod? (Select all that apply)
It is a transitive dependency (not directly imported)
It is not explicitly required by the module's code
The replace directive is used for the dependency
The dependency version is v0.x.x
6. Go modules require a version control system (e.g., Git) to function.
True
False
7. The 'replace' directive in go.mod overrides a dependency with a local directory or alternative version.
True
False
8. What directory does 'go mod vendor' create to store dependencies locally? (single word)
9. What flag with 'go get' updates a dependency to the latest patch version (e.g., v1.2.3 → v1.2.4)?
10. What is the minimum Go version that introduced modules as an experimental feature? (format: X.Y)
Reset
Answered 0 of 0 — 0 correct