Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How Uber "Go"es

How Uber "Go"es

Maintaining a large codebase with maximum readability and minimal overhead is hard. This is the story of how Go language went from a few enthusiastic Gophers to the most popular language for microservices at Uber. Learn where we failed, and how that led us to solutions that we think are pretty darn neat!

Elena Morozova

July 25, 2019
Tweet

Other Decks in Programming

Transcript

  1. level := os.Getenv("LOG_LEVEL") if level == "" { level =

    "info" } logger := log.New(os.Stdout, level, ...)
  2. logger level := os.Getenv("LOG_LEVEL") if level == "" { level

    = "info" } logger := log.New(os.Stdout, level, ...)
  3. logger config etc server ... tracer := tracing.New(logger, config) //

    * *jaegertracing.io server := lib.NewServer(lib.WithTracer(tracer))
  4. logger config etc server ... logger config etc server ...

    ... logger config etc server tracer
  5. ...

  6. ...

  7. ...

  8. ...

  9. ...

  10. ...

  11. ...

  12. ...

  13. ...

  14. ...

  15. ...

  16. ...

  17. package uberfx var Module = fx.Options( configfx, loggerfx, tracingfx, ...

    ) package main func main() { fx.New( uberfx.Module, ... ).Run() } github.com/uber-go/fx
  18. Repositories . . . Controllers List Users Request SELECT *

    FROM mysql; SELECT * FROM cassandra;
  19. Repositories . . . Controllers List Users Request SELECT *

    FROM mysql; SELECT * FROM cassandra;
  20. ├── app ├── controller ├── entity ├── gateway ├── gen

    │ └── [generated goodies] ├── handler └── repository $ glue new service
  21. • • ├── app ├── controller ├── entity ├── gateway

    ├── gen │ └── [generated goodies] ├── handler └── repository
  22. ...

  23. ...

  24. ...

  25. ...

  26. ...

  27. ...

  28. ...

  29. ...

  30. ...

  31. ...

  32. ...