
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?
Jawaban
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?
Jawaban
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?
Jawaban
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 pertanyaan wawancara
Topik wawancara Go lainnya
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
Kuasai Go untuk wawancara berikutnya
Akses semua pertanyaan, flashcards, tes teknis, latihan code review dan simulator wawancara.
Mulai gratis