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

Accelerate Go development with Bazel

micnncim
October 28, 2019

Accelerate Go development with Bazel

micnncim

October 28, 2019
Tweet

More Decks by micnncim

Other Decks in Programming

Transcript

  1. Accelerate Go development
    with Bazel
    Go Conference 2019 Autumn
    @micnncim

    View full-size slide

  2. @micnncim
    University Student / B4
    Merpay ← AbemaTV ← Gunosy

    View full-size slide

  3. Ad
    Software Design 2020 1

    View full-size slide


  4. Attention
    Bazel Go

    View full-size slide

  5. Bazel need for Go

    View full-size slide

  6. Use cases of Go
    Microservices
    Protobuf (Protocol Bu ers)
    GoMock Thrift
    Kubernetes, Istio,

    View full-size slide

  7. Hard points
    Monorepo
    Protobuf
    go build

    View full-size slide

  8. Monorepo
    ッ 1,000
    ッ 1 2 2,000
    ッ Make le 1,000 go build
    ッ local
    CI

    View full-size slide

  9. Protobuf
    VCS
    Docker

    View full-size slide

  10. Bazel 1.0.0 Release
    2019/10/10

    View full-size slide

  11. Overview
    ッ Google OSS multi-language
    ッ Starlark Python

    ッ Buck (Facebook), Pants (Twitter)

    View full-size slide

  12. Fast


    ッ Remote Caching

    View full-size slide

  13. Reproducible
    ッ Sandbox /

    ッ Go protoc kubectl

    ッ local, CI, ,

    View full-size slide

  14. How does Bazel work?
    1. Loading phase: BUILD
    ッ Bazel WORKSPACE
    BUILD
    ッ Starlark

    View full-size slide

  15. How does Bazel work?
    2. Analysis phase: DAG (directed acyclic
    graph) action graph
    action : run gcc on hello.c and get hello.o
    aciton graph Bazel
    track

    View full-size slide

  16. How does Bazel work?
    3. Execution phase: build action

    View full-size slide

  17. Use cases
    Google, Uber, Dropbox, Pinterest, Stripe,
    Microservices with Monorepo
    Kubernetes, Envoy, Protobuf, Tensor ow, Angular,
    Google OSS Bazel

    View full-size slide

  18. Monorepo


    ッ bazel build //

    View full-size slide

  19. Rebuild by go build
    go version: go1.13 darwin/amd64

    View full-size slide

  20. Rebuild by bazel build
    bazel version: 0.28.1

    View full-size slide

  21. Protobuf
    ッ protoc
    ッ Bazel Sandbox
    VCS
    ッ GoMock

    View full-size slide

  22. Practice
    ッ Go protoc
    ッ Gazelle (BUILD )
    ッ .bazelrc ( )
    ッ Bazelisk (Bazel )
    ッ nogo (Go Bazel )

    View full-size slide

  23. Gazelle
    bazelbuild/bazel-gazelle
    Go BUILD
    Go

    View full-size slide

  24. .bazelrc
    Bazel 100
    .bazelrc

    View full-size slide

  25. Bazelisk
    bazelbuild/bazelisk
    .bazelversion
    Bazel
    (OS, Arch) Bazel

    View full-size slide

  26. nogo
    bazelbuild/rules_go
    Go Analyzer

    View full-size slide

  27. Bazel in OSS

    View full-size slide

  28. in OSS
    ッ Kubernetes kazel
    ッ Istio Bazel go build

    View full-size slide

  29. THANK YOU!
    @micnncim

    View full-size slide