Few more general instructions, since this is your first luci-go task, and IIUC, you are not familiar with our go environment.
There are multiple ways to get and build luci-go code. Simplest is to use infra.git's hermetic Go environment (same as used by the bots to run tests) [1]:
1. Checkout infra.git gclient solution (if you don't have it already): "fetch infra". ('fetch' is part of depot_tools).
2. This solution contains luci-go inside of it, pinned at some good revision: https://chromium.googlesource.com/infra/infra/+/master/DEPS#25 This is the revision used to build Go code that is located directly in infra.git repo.
3. Since we are want to develop luci-go at HEAD, we need to checkout latest revision:
cd <solution_root>/infra/go/src/github.com/luci/luci-go/
git fetch origin
git checkout origin/master
4. Next we will need to switch console into the infra's go environment. It contains go toolset and a bunch of other executables (like protocol buffer compiler):
cd <solution_root>/infra/go/
eval `./env.py`
(env.py is a script that installs and updates everything. It spits out shell script that modifies PATH and other environment variable. By eval executes this script directly inside current shell, thus updating PATH).
5. To confirm:
go version
> go version go1.8.3 darwin/amd64
6. Now the current shell has perfectly capable Go toolset (with configured PATH, GOROOT and GOPATH). The root of the Go workspace is '<solution_root>/infra/go/'. In particular, all source code is in '<solution_root>/infra/go/src'. All go commands accept package paths relative to this root.
7. For example, to run test for all LUCI Scheduler code:
go test github.com/luci/luci-go/scheduler/...
8. Same way of doing it:
cd <solution_root>/infra/go/src/github.com/luci/luci-go/scheduler/
go test ./...
9. Making new CL and uploading it for review is standard depot_tools flow:
git new-branch my_feature
...
git cl upload
(We still use Rietveld, it will upload to Rietveld).
(If you are not familiar with 'new-branch' there's excellent depot_tools tutorial [2]).
10. You can run LUCI Scheduler GAE app locally using 'gae.py' tool (it's a wrapper around GAE SDK, it's in PATH due to eval `./env.py` call in step 4):
cd .../luci-go/scheduler/appengine
gae.py devserver
// Then visit http://localhost:8080/ in the browser (it is a bit slow on first request, since it compiles all source code).
11. Deploying is also done through gae.py:
cd .../luci-go/scheduler/appengine
gae.py upload -A luci-scheduler-dev
(You may not have permissions to do so, though).
----
Links:
[1] https://chromium.googlesource.com/infra/infra/+/master/go/README.md
[2] https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html
Comment 1 by vadimsh@chromium.org
, Jul 24 2017Few more general instructions, since this is your first luci-go task, and IIUC, you are not familiar with our go environment. There are multiple ways to get and build luci-go code. Simplest is to use infra.git's hermetic Go environment (same as used by the bots to run tests) [1]: 1. Checkout infra.git gclient solution (if you don't have it already): "fetch infra". ('fetch' is part of depot_tools). 2. This solution contains luci-go inside of it, pinned at some good revision: https://chromium.googlesource.com/infra/infra/+/master/DEPS#25 This is the revision used to build Go code that is located directly in infra.git repo. 3. Since we are want to develop luci-go at HEAD, we need to checkout latest revision: cd <solution_root>/infra/go/src/github.com/luci/luci-go/ git fetch origin git checkout origin/master 4. Next we will need to switch console into the infra's go environment. It contains go toolset and a bunch of other executables (like protocol buffer compiler): cd <solution_root>/infra/go/ eval `./env.py` (env.py is a script that installs and updates everything. It spits out shell script that modifies PATH and other environment variable. By eval executes this script directly inside current shell, thus updating PATH). 5. To confirm: go version > go version go1.8.3 darwin/amd64 6. Now the current shell has perfectly capable Go toolset (with configured PATH, GOROOT and GOPATH). The root of the Go workspace is '<solution_root>/infra/go/'. In particular, all source code is in '<solution_root>/infra/go/src'. All go commands accept package paths relative to this root. 7. For example, to run test for all LUCI Scheduler code: go test github.com/luci/luci-go/scheduler/... 8. Same way of doing it: cd <solution_root>/infra/go/src/github.com/luci/luci-go/scheduler/ go test ./... 9. Making new CL and uploading it for review is standard depot_tools flow: git new-branch my_feature ... git cl upload (We still use Rietveld, it will upload to Rietveld). (If you are not familiar with 'new-branch' there's excellent depot_tools tutorial [2]). 10. You can run LUCI Scheduler GAE app locally using 'gae.py' tool (it's a wrapper around GAE SDK, it's in PATH due to eval `./env.py` call in step 4): cd .../luci-go/scheduler/appengine gae.py devserver // Then visit http://localhost:8080/ in the browser (it is a bit slow on first request, since it compiles all source code). 11. Deploying is also done through gae.py: cd .../luci-go/scheduler/appengine gae.py upload -A luci-scheduler-dev (You may not have permissions to do so, though). ---- Links: [1] https://chromium.googlesource.com/infra/infra/+/master/go/README.md [2] https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html