raul

raul

Distributed Services with Go: Chapter 2 suggestions

Hi TJ, Suggestions on Chapter 2 of the book:

To send data (such as your structs) over a network

  • Not sure whether a layperson would translate structs mentally to the same intended here

• Guarantees type-safety;
• Prevents schema-violations;

  • Sorry if it’s a dumb question but how are these two different?

http://media.pragprog.com/titles/tjgo/code/StructureDataWithProtobuf/example.proto

  • syntax = “proto3”; is repeated twice in the file - is that intended?
  • What about the Person and Animal entries? Do they need to be removed? Along with the import setter possibly.

http://media.pragprog.com/titles/tjgo/code/StructureDataWithProtobuf/example.pb.go

So run mkdir -p api/v1 to create your directories

  • Maybe mention this is in a different top-level directory than the one in chapter 1?
  • Also is the StructureDataWithProtobuf/ the same for all of Chapter 2?

and with protobuf you put the name of the field on right followed by its name (with an additional field id).

  • put the ‘name’ of the field → put the ‘type’ of the field?

if you look at Google’s API definitions[GitHub - googleapis/googleapis: Public interface definitions of Google APIs.] protobuf

  • Where is the version bump indicated exactly, I could see only v1s?

protoc api/v1/*.proto \ --gogo_out=Mgogoproto/gogo.proto=github.com/gogo/protobuf/proto:. \ --proto_path=$(go list -f ‘{{ .Dir }}’ -m github.com/gogo/protobuf) \ --proto_path=.

  • Output with the slashes on MacOS Catalina 10.15.7: Missing output directives.
  • Removed the slashes: protoc api/v1/*.proto --gogo_out=Mgogoproto/gogo.proto=github.com/gogo/protobuf/proto:. --proto_path=$(go list -f ‘{{ .Dir }}’ -m github.com/gogo/protobuf) --proto_path=.
  • Ran successfully and generated the log.pb.go

it’s worth adding a Makefile with a compile target that you can quickly run again and again

  • Maybe add ‘run with make or make compile’ for people not familiar with make?
  • The make command did succeed in generating the pb.go with no issues

imagine you’re building a retail site like Amazon and have different types stuff you sell

  • different types stuff → different types 'of ’ stuff

Popular Pragmatic Bookshelf topics Top

alanq
This isn’t directly about the book contents so maybe not the right forum…but in some of the code apps (e.g. turbo/06) it sends a TURBO_ST...
New
leba0495
Hello! Thanks for the great book. I was attempting the Trie (chap 17) exercises and for number 4 the solution provided for the autocorre...
New
leonW
I ran this command after installing the sample application: $ cards add do something --owner Brian And got a file not found error: Fil...
New
adamwoolhether
I’m not quite sure what’s going on here, but I’m unable to have to containers successfully complete the Readiness/Liveness checks. I’m im...
New
AufHe
I’m a newbie to Rails 7 and have hit an issue with the bin/Dev script mentioned on pages 112-113. Iteration A1 - Seeing the list of prod...
New
Henrai
Hi, I’m working on the Chapter 8 of the book. After I add add the point_offset, I’m still able to see acne: In the image above, I re...
New
a.zampa
@mfazio23 I’m following the indications of the book and arriver ad chapter 10, but the app cannot be compiled due to an error in the Bas...
New
bjnord
Hello @herbert ! Trying to get the very first “Hello, Bracket Terminal!" example to run (p. 53). I develop on an Amazon EC2 instance runn...
New
redconfetti
Docker-Machine became part of the Docker Toolbox, which was deprecated in 2020, long after Docker Desktop supported Docker Engine nativel...
New
roadbike
From page 13: On Python 3.7, you can install the libraries with pip by running these commands inside a Python venv using Visual Studio ...
New

Other popular topics Top

Devtalk
Reading something? Working on something? Planning something? Changing jobs even!? If you’re up for sharing, please let us know what you’...
1021 17087 374
New
AstonJ
What chair do you have while working… and why? Is there a ‘best’ type of chair or working position for developers?
New
ohm
Which, if any, games do you play? On what platform? I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
New
PragmaticBookshelf
Rust is an exciting new programming language combining the power of C with memory safety, fearless concurrency, and productivity boosters...
New
AstonJ
This looks like a stunning keycap set :orange_heart: A LEGENDARY KEYBOARD LIVES ON When you bought an Apple Macintosh computer in the e...
New
PragmaticBookshelf
“Finding the Boundaries” Hero’s Journey with Noel Rappin @noelrappin Even when you’re ultimately right about what the future ho...
New
Rainer
Not sure if following fits exactly this thread, or if we should have a hobby thread… For many years I’m designing and building model air...
New
gagan7995
API 4 Path: /user/following/ Method: GET Description: Returns the list of all names of people whom the user follows Response [ { ...
New
mafinar
This is going to be a long an frequently posted thread. While talking to a friend of mine who has taken data structure and algorithm cou...
New
AnfaengerAlex
Hello, I’m a beginner in Android development and I’m facing an issue with my project setup. In my build.gradle.kts file, I have the foll...
New

Sub Categories: