A Go module is a versioned unit of Go source code and dependency metadata. It gives a microservice a VCS-backed identity, records its Go version in go.mod, and makes dependencies reproducible across development and deployment. section 4.2.2 section 3.3.1
Use a module to:
- Initialize a service with a repository path, such as github.com/<username>/microservices/order, and establish its dependency structure. section 4.2.2
- Publish generated gRPC service code from language-specific subfolders as independently addressable Go dependencies. section 3.3.1
- Choose between a moving dependency such as @latest and a fixed version to reduce unexpected behavior when dependencies refresh. section 5.2
- Keep end-to-end tests in a separate module with their own Docker Compose resources and database migrations. section 7.4.3
Versioning a payment client dependency
An Order service can add the Payment service with go get -u github.com/huseyinbabal/microservices-proto/golang/payment, or pin it with @v1.0.38. The resulting payment client can then call Create across the service boundary. section 5.2
├── golang #1
│ ├── order
│ │ ├── go.mod #2
│ │ ├── go.sum #3
│ │ ├── order.pb.go #4
│ │ └── order_grpc.pb.go #5
│ ├── payment
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── payment.pb.go
│ │ └── payment_grpc.pb.go
│ └── shipping
│ ├── go.mod
│ ├── go.sum
│ ├── shipping.pb.go
│ └── shipping_grpc.pb.go
├── order
│ └── order.proto
├── payment
│ └── payment.proto
└── shipping
└── shipping.proto
Inspect the repository layout to see how .proto definitions coexist with generated Go modules for order, payment, and shipping services. section 3.3.1



