Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to initialize a new Go module.
Go
go [1] init example.com/mymodule Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'go module init' instead of 'go mod init'.
Using 'go init' without 'mod'.
✗ Incorrect
The correct command to initialize a new Go module is go mod init.
2fill in blank
mediumComplete the code to add a dependency to your Go module.
Go
go [1] get github.com/gin-gonic/gin@v1.7.7
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'go mod install' which is not a valid command.
Using 'go add' which does not exist in Go tooling.
✗ Incorrect
The command go get is used to add or update dependencies in a Go module.
3fill in blank
hardFix the error in the command to tidy the module dependencies.
Go
go mod [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'go mod clean' which is not a valid command.
Using 'go mod update' which does not exist.
✗ Incorrect
The go mod tidy command cleans up unused dependencies and adds missing ones.
4fill in blank
hardFill both blanks to print the current module's path and version.
Go
go [1] [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'go mod -m' which is not a valid command.
Using 'go mod info' which is not a valid flag.
✗ Incorrect
The command go list -m lists the main module's path and version.
5fill in blank
hardFill both blanks to upgrade a dependency to the latest version.
Go
go [1] github.com/pkg/errors@[2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'go mod get' which is not a valid command.
Using 'latest' without '@' symbol.
✗ Incorrect
The command go get github.com/pkg/errors@latest upgrades the dependency to the latest version.