| OLD | NEW |
| 1 # Chromium Infra Go Area | 1 # Chromium Infra Go Area |
| 2 | 2 |
| 3 [TOC] | 3 [TOC] |
| 4 | 4 |
| 5 |
| 6 ## Get the code |
| 7 |
| 8 The steps for getting the code are: |
| 9 |
| 10 1. [Install depot_tools](https://www.chromium.org/developers/how-tos/install-de
pot-tools) |
| 11 1. Run `fetch infra` |
| 12 1. Run `infra/go/env.py` |
| 13 |
| 14 |
| 15 ### Quick Setup |
| 16 |
| 17 If you are on Linux you can run the [quicksetup script](quicksetup.sh) like so: |
| 18 |
| 19 ```shell |
| 20 cd /where/you/want/source/code |
| 21 wget -O- "https://chromium.googlesource.com/infra/infra/+/master/go/quicksetup.s
h?format=TEXT" | base64 -d | bash |
| 22 ``` |
| 23 |
| 24 This will create a self-contained `cr-infra-go-area` directory and populate it |
| 25 will all necessary tools and source for using or contributing to Chromium's Go |
| 26 Infrastructure. Once run, look in `cr-infra-go-area/infra/go/src` for the |
| 27 editable source code. |
| 28 |
| 29 |
| 5 ## Structure | 30 ## Structure |
| 6 | 31 |
| 7 This directory contains a set of scripts to setup and manage a hermetic Go | 32 This directory contains a set of scripts to setup and manage a hermetic Go |
| 8 building environment. We pin versions of the Go toolset and all third party | 33 building environment. We pin versions of the Go toolset and all third party |
| 9 dependencies that the infra code is using. It is important for getting | 34 dependencies that the infra code is using. It is important for getting |
| 10 non-flaky, reproducible builds of Go code on a CI and on developers' machines. | 35 non-flaky, reproducible builds of Go code on a CI and on developers' machines. |
| 11 | 36 |
| 12 Structurally `infra/go` represents two workspaces (two directories in | 37 Structurally `infra/go` represents two workspaces (two directories in |
| 13 `$GOPATH`): | 38 `$GOPATH`): |
| 14 | 39 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 29 [luci-go](https://github.com/luci/luci-go) project that **is** a proper Go | 54 [luci-go](https://github.com/luci/luci-go) project that **is** a proper Go |
| 30 package and can be fetched with `go get`. | 55 package and can be fetched with `go get`. |
| 31 | 56 |
| 32 luci-go doesn't pin any dependencies, assuming the end users (whoever links to | 57 luci-go doesn't pin any dependencies, assuming the end users (whoever links to |
| 33 it) will do it themselves. `infra/go` workspace is one such end user. This | 58 it) will do it themselves. `infra/go` workspace is one such end user. This |
| 34 approach allows projects that use multiple big libraries (like luci-go) to | 59 approach allows projects that use multiple big libraries (like luci-go) to |
| 35 manage all dependencies centrally in a single place, thus avoiding issues of | 60 manage all dependencies centrally in a single place, thus avoiding issues of |
| 36 version conflicts and binary bloat due to inclusion of a same third party code | 61 version conflicts and binary bloat due to inclusion of a same third party code |
| 37 via multiple import paths. | 62 via multiple import paths. |
| 38 | 63 |
| 64 |
| 39 ## Bootstrap | 65 ## Bootstrap |
| 40 | 66 |
| 41 `infra/go` knows how to bootstrap itself from scratch (i.e. from a fresh | 67 `infra/go` knows how to bootstrap itself from scratch (i.e. from a fresh |
| 42 checkout) by downloading pinned version of Go toolset, and installing pinned | 68 checkout) by downloading pinned version of Go toolset, and installing pinned |
| 43 versions of third party packages it needs into `infra/go/.vendor` directory, and | 69 versions of third party packages it needs into `infra/go/.vendor` directory, and |
| 44 adding a bunch of third party tools (like `goconvey` and `protoc-gen-go`) to | 70 adding a bunch of third party tools (like `goconvey` and `protoc-gen-go`) to |
| 45 `$PATH`. | 71 `$PATH`. |
| 46 | 72 |
| 47 The bootstrap (and self-update) procedure is invoked whenever `go/bootstrap.py` | 73 The bootstrap (and self-update) procedure is invoked whenever `go/bootstrap.py` |
| 48 or `go/env.py` run. There's **no** DEPS hook for this. We only want the Go | 74 or `go/env.py` run. There's **no** DEPS hook for this. We only want the Go |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 Some Golang related packages are already on `*.googlesource.com` (though it may | 173 Some Golang related packages are already on `*.googlesource.com` (though it may |
| 148 be non obvious at the first glance). For example all `golang.org/x/*` ones are | 174 be non obvious at the first glance). For example all `golang.org/x/*` ones are |
| 149 actually served from `https://go.googlesource.com/`. | 175 actually served from `https://go.googlesource.com/`. |
| 150 | 176 |
| 151 `deps.py` will warn you if it sees a package being referenced from | 177 `deps.py` will warn you if it sees a package being referenced from |
| 152 a source-of-truth repo, and not a mirror. | 178 a source-of-truth repo, and not a mirror. |
| 153 | 179 |
| 154 If you are positive that a mirror is needed, file | 180 If you are positive that a mirror is needed, file |
| 155 [Infra-Git](https://bugs.chromium.org/p/chromium/issues/entry?template=Infra-Git
) | 181 [Infra-Git](https://bugs.chromium.org/p/chromium/issues/entry?template=Infra-Git
) |
| 156 ticket specifying what repository you need to be mirrored. | 182 ticket specifying what repository you need to be mirrored. |
| OLD | NEW |