8c8ff75b2d3f6171116fe1e46e909361875a8f77
…
Go Cart Actor
A distributed cart management system using the actor model pattern.
Prerequisites
- Go 1.24.2+
- Protocol Buffers compiler (
protoc) - protoc-gen-go plugin
Installing Protocol Buffers
On Windows:
winget install protobuf
On macOS:
brew install protobuf
On Linux:
# Ubuntu/Debian
sudo apt install protobuf-compiler
# Or download from: https://github.com/protocolbuffers/protobuf/releases
Installing Go protobuf plugin
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
Working with Protocol Buffers
Generating Go code from proto files
After modifying proto/messages.proto, regenerate the Go code:
cd proto
protoc --go_out=. --go_opt=paths=source_relative messages.proto
Protocol Buffer Messages
The proto/messages.proto file defines the following message types:
AddRequest- Add items to cart (includes quantity, sku, country, optional storeId)SetCartRequest- Set entire cart contentsAddItem- Complete item information for cartRemoveItem- Remove item from cartChangeQuantity- Update item quantitySetDelivery- Configure delivery optionsSetPickupPoint- Set pickup locationPickupPoint- Pickup point detailsRemoveDelivery- Remove delivery optionCreateCheckoutOrder- Initiate checkoutOrderCreated- Order creation response
Building the project
go build .
Running tests
go test ./...
Important Notes
- Always regenerate protobuf Go code after modifying
.protofiles - The generated
messages.pb.gofile should not be edited manually - Make sure your PATH includes the protoc-gen-go binary location (usually
$GOPATH/bin)
Description
Languages
Go
95.9%
JavaScript
1.8%
Makefile
1.4%
Dockerfile
0.9%