Fichas
Setting Up Your Go Environment
Fichas del conjunto (14)
- 1What is a Go project called and what does it include?A Go project is called a module and includes source code and dependency specification.
- 2What file is created with go mod init and what does it contain?The go.mod file is created with go mod init and contains the module name, minimum Go version, and dependencies.
- 3What is the purpose of the package declaration in Go code?The package declaration organizes code into packages and is the first line in Go code.
- 4What is the main package in Go?The main package contains the code that starts the Go program.
- 5What does the import statement in Go do?The import statement lists referenced packages; Go imports entire packages only.
- 6How is the main function declared in Go and what is its purpose?The main function is declared with func main() and is the entry point of all Go programs.
- 7What does the go fmt command do?The go fmt command automatically fixes whitespace to standard format.
- 8Why is code formatting standardized in Go?Standardized code formatting avoids style arguments and ensures consistency.
- 9What is the ./... syntax used for in Go?The ./... syntax applies Go tool commands to all files in the current directory and subdirectories.
- 10What is a best practice before compiling Go code or committing changes?Running go fmt is a best practice before compiling code or committing changes.
- 11What is the semicolon insertion rule in Go?The Go compiler auto-inserts semicolons, so developers shouldn't add them manually.
- 12When does semicolon insertion occur in Go?Semicolon insertion occurs after identifiers, literals, and certain tokens (e.g., break, return, ++, --, )).
- 13What does the go vet command do?The go vet command detects likely incorrect, but syntactically valid code errors.
- 14Why are Makefiles used in Go projects?Makefiles ensure repeatable builds and define build steps and order,.
Información
- Descripción
- Book (CH1: Setting Up Your Go Environment) Learning Go Fichas sobre Setting Up Your Go Environment, creado por Filipi Melo el 31/07/2024.
- Creado por
- Filipi Melo
- Visitas
- 0
- Valoración