Live data from Hacker News

Uber Go Style Guide

github.com

31–40 of 140 posts

Re: Uber Go Style Guide

#31
post #22

Earlier quoted context omitted.

Uber have well over 1,500 microservices written in Go, it is the primary language backend services are written in at Uber.

> Uber have well over 1,500 microservices written in Go 1500 ?! I can't even imagine how micro a microservice could be such that Uber could have so many. edit: Having said that, the Monzo blog post also on the front page says it has 1100 microservices, so I suppose I've just not worked somewhere with 'actual' microservices. What constitutes a 'service', a single procedure for RPC?

I don't work at Uber, so I can't answer your questions around motivation, but I took the 1,500 value from this presentation at Gophercon this year: https://www.youtube.com/watch?v=nLskCRJOdxM&t=22m59s

Re: Uber Go Style Guide

#33
post #4

"Copy Slices and Maps at Boundaries. Slices and maps contain pointers to the underlying data so be wary of scenarios when they need to be copied. Keep in mind that users can modify a map or slice you received as an argument if you store a reference to it. Similarly, be wary of user modifications to maps or slices exposing internal state." This could be used as an ad for Rust borrow checker, verbatim. You can't modify…

Yes, that's not good, but it seems like in practice this doesn't come up too often in Go? More typically you're building a new slice containing the results of a query or other computation, and returning it without keeping a reference. Or instead of exposing an internal map, you have a Get method.

It apparently comes up often enough to be in Uber Go Style Guide.

Re: Uber Go Style Guide

#34
post #4

"Copy Slices and Maps at Boundaries. Slices and maps contain pointers to the underlying data so be wary of scenarios when they need to be copied. Keep in mind that users can modify a map or slice you received as an argument if you store a reference to it. Similarly, be wary of user modifications to maps or slices exposing internal state." This could be used as an ad for Rust borrow checker, verbatim. You can't modify…

[deleted]

Re: Uber Go Style Guide

#35
post #33

Earlier quoted context omitted.

Yes, that's not good, but it seems like in practice this doesn't come up too often in Go? More typically you're building a new slice containing the results of a query or other computation, and returning it without keeping a reference. Or instead of exposing an internal map, you have a Get method.

It apparently comes up often enough to be in Uber Go Style Guide.

I think the author are just being thorough

Re: Uber Go Style Guide

#36
post #2

Is Go the primary language in Uber now? I see a lot of tools written in Go coming out of Uber. What kind of services inside Uber is Go used for?

Probabaly more of an emotional, rather then rational decision. I heard that many Go folks from Google joined Uber.

Looking at the stock, they probably should focus on building new things/better the business model, rather then rewriting things in Go.

Re: Uber Go Style Guide

#37
post #22

Earlier quoted context omitted.

Uber have well over 1,500 microservices written in Go, it is the primary language backend services are written in at Uber.

> Uber have well over 1,500 microservices written in Go 1500 ?! I can't even imagine how micro a microservice could be such that Uber could have so many. edit: Having said that, the Monzo blog post also on the front page says it has 1100 microservices, so I suppose I've just not worked somewhere with 'actual' microservices. What constitutes a 'service', a single procedure for RPC?

I would imagine quite a services to just deal with legislation/taxation stuff in all the different markets they operate in. These can also result on several integrations to government systems - all country specific. In some markets they are partnering with taxi companies - maybe more integrations for ordering and reporting.

In general it is easy to underestimate the complexity of systems you are not familiar with. The devil is in the details and deeper you look, more complicated it usually gets.

Re: Uber Go Style Guide

#38
post #4

"Copy Slices and Maps at Boundaries. Slices and maps contain pointers to the underlying data so be wary of scenarios when they need to be copied. Keep in mind that users can modify a map or slice you received as an argument if you store a reference to it. Similarly, be wary of user modifications to maps or slices exposing internal state." This could be used as an ad for Rust borrow checker, verbatim. You can't modify…

Yes, that's not good, but it seems like in practice this doesn't come up too often in Go? More typically you're building a new slice containing the results of a query or other computation, and returning it without keeping a reference. Or instead of exposing an internal map, you have a Get method.

> but it seems like in practice this doesn't come up too often in Go?

It comes up in any language that allows shared mutable state, so not much in functional languages which discourage mutability or Rust which discourages shared mutability.

On the other hand, most code tries to avoid shared mutable state by convention, there’s a nice bit in the Go lang design article that basically says convention is good enough, significantly simplifies the language, at the cost of the odd bug.

Re: Uber Go Style Guide

#39
post #22

Earlier quoted context omitted.

Uber have well over 1,500 microservices written in Go, it is the primary language backend services are written in at Uber.

> Uber have well over 1,500 microservices written in Go 1500 ?! I can't even imagine how micro a microservice could be such that Uber could have so many. edit: Having said that, the Monzo blog post also on the front page says it has 1100 microservices, so I suppose I've just not worked somewhere with 'actual' microservices. What constitutes a 'service', a single procedure for RPC?

[deleted]

Re: Uber Go Style Guide

#40
post #29
post #22

Earlier quoted context omitted.

> Uber have well over 1,500 microservices written in Go 1500 ?! I can't even imagine how micro a microservice could be such that Uber could have so many. edit: Having said that, the Monzo blog post also on the front page says it has 1100 microservices, so I suppose I've just not worked somewhere with 'actual' microservices. What constitutes a 'service', a single procedure for RPC?

The target is one microservice per syscall, maybe.

[deleted]
Post reply on HN