Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: client/isolate/isolate.go

Issue 1846263002: Isolate: Use generators instead of seekers (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: Tweaks from comments. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package isolate 5 package isolate
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "encoding/json" 9 "encoding/json"
10 "errors" 10 "errors"
11 "io/ioutil" 11 "io/ioutil"
12 "log" 12 "log"
13 "os" 13 "os"
14 "path/filepath" 14 "path/filepath"
15 "regexp" 15 "regexp"
16 "sort" 16 "sort"
17 "strings" 17 "strings"
18 18
19 "github.com/luci/luci-go/client/archiver" 19 "github.com/luci/luci-go/client/archiver"
20 "github.com/luci/luci-go/client/internal/common" 20 "github.com/luci/luci-go/client/internal/common"
21 "github.com/luci/luci-go/client/internal/tracer" 21 "github.com/luci/luci-go/client/internal/tracer"
22 "github.com/luci/luci-go/client/isolatedclient"
22 "github.com/luci/luci-go/common/flag/stringmapflag" 23 "github.com/luci/luci-go/common/flag/stringmapflag"
23 "github.com/luci/luci-go/common/isolated" 24 "github.com/luci/luci-go/common/isolated"
24 ) 25 )
25 26
26 // IsolatedGenJSONVersion is used in the batcharchive json format. 27 // IsolatedGenJSONVersion is used in the batcharchive json format.
27 // 28 //
28 // TODO(tandrii): Migrate to batch_archive.go. 29 // TODO(tandrii): Migrate to batch_archive.go.
29 const IsolatedGenJSONVersion = 1 30 const IsolatedGenJSONVersion = 1
30 31
31 // ValidVariable is the regexp of valid isolate variable name. 32 // ValidVariable is the regexp of valid isolate variable name.
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 sort.Sort(i.Includes) 294 sort.Sort(i.Includes)
294 295
295 raw := &bytes.Buffer{} 296 raw := &bytes.Buffer{}
296 if err = json.NewEncoder(raw).Encode(i); err != nil { 297 if err = json.NewEncoder(raw).Encode(i); err != nil {
297 return nil, err 298 return nil, err
298 } 299 }
299 300
300 if err := ioutil.WriteFile(opts.Isolated, raw.Bytes(), 0644); err != nil { 301 if err := ioutil.WriteFile(opts.Isolated, raw.Bytes(), 0644); err != nil {
301 return nil, err 302 return nil, err
302 } 303 }
303 » return arch.Push(displayName, bytes.NewReader(raw.Bytes()), 0), nil 304 » return arch.Push(displayName, isolatedclient.NewBytesSource(raw.Bytes()) , 0), nil
304 } 305 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698