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

Side by Side Diff: go/src/infra/libs/parallel/parallel_test.go

Issue 1153883002: go: infra/libs/* now live in luci-go. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: move the rest too Created 5 years, 7 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
« no previous file with comments | « go/src/infra/libs/parallel/parallel.go ('k') | go/src/infra/monitoring/analyzer/analyzer.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 package parallel
6
7 import (
8 "fmt"
9 )
10
11 func ExampleFanOutIn() {
12 data := []int{1, 20}
13 err := FanOutIn(func(ch chan<- func() error) {
14 for _, d := range data {
15 d := d
16 ch <- func() error {
17 if d > 10 {
18 return fmt.Errorf("%d is over 10", d)
19 }
20 return nil
21 }
22 }
23 })
24
25 fmt.Printf("got: %s", err)
26 // Output: got: ["20 is over 10"]
27 }
OLDNEW
« no previous file with comments | « go/src/infra/libs/parallel/parallel.go ('k') | go/src/infra/monitoring/analyzer/analyzer.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698