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

jon
Some minor things in the paper edition that says “3 2020” on the title page verso, not mentioned in the book’s errata online: p. 186 But...
New
JohnS
I can’t setup the Rails source code. This happens in a working directory containing multiple (postgres) Rails apps. With: ruby-3.0.0 s...
New
joepstender
The generated iex result below should list products instead of product for the metadata. (page 67) iex> product = %Product{} %Pento....
New
patoncrispy
I’m new to Rust and am using this book to learn more as well as to feed my interest in game dev. I’ve just finished the flappy dragon exa...
New
AndyDavis3416
@noelrappin Running the webpack dev server, I receive the following warning: ERROR in tsconfig.json TS18003: No inputs were found in c...
New
curtosis
Running mix deps.get in the sensor_hub directory fails with the following error: ** (Mix) No SSH public keys found in ~/.ssh. An ssh aut...
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
gorkaio
root_layout: {PentoWeb.LayoutView, :root}, This results in the following following error: no “root” html template defined for PentoWeb...
New
dachristenson
I just bought this book to learn about Android development, and I’m already running into a major issue in Ch. 1, p. 20: “Update activity...
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
siddhant3030
I’m thinking of buying a monitor that I can rotate to use as a vertical monitor? Also, I want to know if someone is using it for program...
New
DevotionGeo
I know that -t flag is used along with -i flag for getting an interactive shell. But I cannot digest what the man page for docker run com...
New
New
AstonJ
Curious to know which languages and frameworks you’re all thinking about learning next :upside_down_face: Perhaps if there’s enough peop...
New
Rainer
My first contact with Erlang was about 2 years ago when I used RabbitMQ, which is written in Erlang, for my job. This made me curious and...
New
AstonJ
I have seen the keycaps I want - they are due for a group-buy this week but won’t be delivered until October next year!!! :rofl: The Ser...
New
rustkas
Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
New
First poster: bot
zig/http.zig at 7cf2cbb33ef34c1d211135f56d30fe23b6cacd42 · ziglang/zig. General-purpose programming language and toolchain for maintaini...
New
CommunityNews
A Brief Review of the Minisforum V3 AMD Tablet. Update: I have created an awesome-minisforum-v3 GitHub repository to list information fo...
New

Sub Categories: