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

Where Next?

Popular Pragmatic Bookshelf topics Top

johnp
Running the examples in chapter 5 c under pytest 5.4.1 causes an AttributeError: ‘module’ object has no attribute ‘config’. In particula...
New
mikecargal
Title: Hands-on Rust: question about get_component (page 295) (feel free to respond. “You dug you’re own hole… good luck”) I have somet...
New
raul
Hi Travis! Thank you for the cool book! :slight_smile: I made a list of issues and thought I could post them chapter by chapter. I’m rev...
New
joepstender
The generated iex result below should list products instead of product for the metadata. (page 67) iex> product = %Product{} %Pento....
New
cro
I am working on the “Your Turn” for chapter one and building out the restart button talked about on page 27. It recommends looking into ...
New
gilesdotcodes
In case this helps anyone, I’ve had issues setting up the rails source code. Here were the solutions: In Gemfile, change gem 'rails' t...
New
fynn
This is as much a suggestion as a question, as a note for others. Locally the SGP30 wasn’t available, so I ordered a SGP40. On page 53, ...
New
brunogirin
When running tox for the first time, I got the following error: ERROR: InterpreterNotFound: python3.10 I realised that I was running ...
New
akraut
The markup used to display the uploaded image results in a Phoenix.LiveView.HTMLTokenizer.ParseError error. lib/pento_web/live/product_l...
New
mcpierce
@mfazio23 I’ve applied the changes from Chapter 5 of the book and everything builds correctly and runs. But, when I try to start a game,...
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’...
1033 17470 383
New
PragmaticBookshelf
“Finding the Boundaries” Hero’s Journey with Noel Rappin @noelrappin Even when you’re ultimately right about what the future ho...
New
PragmaticBookshelf
“A Mystical Experience” Hero’s Journey with Paolo Perrotta @nusco Ever wonder how authoring books compares to writing articles?...
New
Maartz
Hi folks, I don’t know if I saw this here but, here’s a new programming language, called Roc Reminds me a bit of Elm and thus Haskell. ...
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
PragmaticBookshelf
Rails 7 completely redefines what it means to produce fantastic user experiences and provides a way to achieve all the benefits of single...
New
PragmaticBookshelf
Author Spotlight: Karl Stolley @karlstolley Logic! Rhetoric! Prag! Wow, what a combination. In this spotlight, we sit down with Karl ...
New
First poster: bot
zig/http.zig at 7cf2cbb33ef34c1d211135f56d30fe23b6cacd42 · ziglang/zig. General-purpose programming language and toolchain for maintaini...
New
sir.laksmana_wenk
I’m able to do the “artistic” part of game-development; character designing/modeling, music, environment modeling, etc. However, I don’t...
New
AstonJ
This is cool! DEEPSEEK-V3 ON M4 MAC: BLAZING FAST INFERENCE ON APPLE SILICON We just witnessed something incredible: the largest open-s...
New

Sub Categories: