commit | 4f458e7f03a67755e691904467ad65e4c91179f9 | [log] [tgz] |
---|---|---|
author | Vadim Shtayura <vadimsh@chromium.org> | Mon Feb 04 20:27:19 2019 |
committer | Commit Bot <commit-bot@chromium.org> | Mon Feb 04 20:27:19 2019 |
tree | a4f45034765b8ad7f5f4a53a8570b6626ebd64df | |
parent | 209795ace740f404761ac7dcaba3863849abcbe4 [diff] |
[lucicfg] Implement lucicfg.var(). Vars can be used to implicitly propagate information down 'exec' call stack, but not up or "sideways". Useful for declaring module-level default values for fields instead of plumbing them through all calls explicitly. Subject to following rules: 1. Only modules that are invoked via 'exec' can set or get variables. Libraries (modules loaded via 'load') can only declare them. This is because libraries are loaded lazily (so essentially at unpredictable moments) and their module dict is cached and reused. The state inside library's module dict must not depend on whatever state variables had when the library was loaded. 2. Each 'exec' call opens a new scope for variables. Variables set within a scope are "forgotten" when exiting the scope. Variable value lookup start with the innermost scope, and goes up to the top scope. Thus variable values propagate down 'exec' call stack, but not up or "sideways". 3. Variables are set-only. If a variable was set in the current scope or any of parent scopes, assigning a new value to it is an error. R=tandrii@chromium.org BUG=833946 Change-Id: Idaf44866125c7cf8ef63247587b5b67eabf0782f Reviewed-on: https://chromium-review.googlesource.com/c/1451101 Commit-Queue: Vadim Shtayura <vadimsh@chromium.org> Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org> Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
LUCI Go code is meant to be worked on from an Chromium infra.git checkout, which enforces packages versions and Go toolchain version. First get fetch via depot_tools.git then run:
fetch infra cd infra/go eval `./env.py` cd src/go.chromium.org/luci
Contributing uses the same flow as Chromium contributions.