syz-ci: move GOPATH/GOROOT setup to main

GOPATH/GOROOT are also needed for jobs.
Updater can be disabled with -autoupdate=0,
so move GOPATH/GOROOT setup to main.

Update #501
This commit is contained in:
Dmitry Vyukov 2019-03-12 14:08:57 +01:00
parent 5900c53a4d
commit 8fb18735b7
2 changed files with 7 additions and 6 deletions

View File

@ -129,6 +129,13 @@ func main() {
serveHTTP(cfg)
os.Unsetenv("GOPATH")
if cfg.Goroot != "" {
os.Setenv("GOROOT", cfg.Goroot)
os.Setenv("PATH", filepath.Join(cfg.Goroot, "bin")+
string(filepath.ListSeparator)+os.Getenv("PATH"))
}
updatePending := make(chan struct{})
updater := NewSyzUpdater(cfg)
updater.UpdateOnStart(*flagAutoUpdate, shutdownPending)

View File

@ -63,12 +63,6 @@ func NewSyzUpdater(cfg *Config) *SyzUpdater {
}
gopath := filepath.Join(wd, "gopath")
os.Unsetenv("GOPATH")
if cfg.Goroot != "" {
os.Setenv("GOROOT", cfg.Goroot)
os.Setenv("PATH", filepath.Join(cfg.Goroot, "bin")+
string(filepath.ListSeparator)+os.Getenv("PATH"))
}
syzkallerDir := filepath.Join(gopath, "src", "github.com", "google", "syzkaller")
osutil.MkdirAll(syzkallerDir)