
Go Modules
go.mod, go.sum, versioning, dependencies, go get, go mod tidy, replace directives
1What is go.mod in a Go project?
What is go.mod in a Go project?
Antwoord
The go.mod file is the Go module definition file. It contains the module name, required Go version and the list of direct dependencies with their versions. It is created with 'go mod init' and enables deterministic dependency management, unlike the old GOPATH.
2What is the role of the go.sum file?
What is the role of the go.sum file?
Antwoord
The go.sum file contains cryptographic checksums (hashes) of all direct and indirect dependencies. It ensures build integrity and reproducibility by verifying that downloaded dependencies have not been modified. Unlike go.mod which only lists direct dependencies, go.sum includes all transitive dependencies.
3How to initialize a new Go module in a project?
How to initialize a new Go module in a project?
Antwoord
The command 'go mod init <module_name>' initializes a new module by creating the go.mod file. The module name is usually the repository path (e.g. github.com/user/project). This command should be executed at the project root, only once when creating the module.
What does the 'go mod tidy' command do?
What is the semantic versioning syntax in go.mod?
+15 gespreksvragen
Andere Go-sollicitatieonderwerpen
Go Basics
Go Data Structures
Go Interfaces
Error Handling
Goroutines Basics
Channels
HTTP Server
HTTP Client
JSON Encoding
database/sql
Context Package
Testing
Concurrency Patterns
Sync Primitives
Go Web Frameworks
REST API Design
gRPC
Reflection
Memory Management
Performance Optimization
Generics
Go Design Patterns
Microservices
Security & Authentication
Docker & Containerization
Kubernetes Basics
Advanced Go
CLI Development
Beheers Go voor je volgende gesprek
Krijg toegang tot alle vragen, flashcards, technische tests, code review-oefeningen en gespreksimulatoren.
Begin gratis