diff --git a/Gopkg.lock b/Gopkg.lock index 83082149328edc52f8245267d1b550dfefaeaf49..9a42fc0e4ba3ff2876af5f56aa0e72c05cd2ceeb 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -382,6 +382,14 @@ pruneopts = "UT" revision = "d2e6202438beef2727060aa7cabdd924d92ebfd9" +[[projects]] + branch = "master" + digest = "1:b521f10a2d8fa85c04a8ef4e62f2d1e14d303599a55d64dabf9f5a02f84d35eb" + name = "golang.org/x/sync" + packages = ["errgroup"] + pruneopts = "UT" + revision = "112230192c580c3556b8cee6403af37a4fc5f28c" + [[projects]] branch = "master" digest = "1:3364d01296ce7eeca363e3d530ae63a2092d6f8efb85fb3d101e8f6d7de83452" @@ -481,6 +489,7 @@ "github.com/xanzy/go-gitlab", "golang.org/x/crypto/ssh/terminal", "golang.org/x/oauth2", + "golang.org/x/sync/errgroup", "golang.org/x/text/runes", "golang.org/x/text/transform", ] diff --git a/Gopkg.toml b/Gopkg.toml index 9f5cb539354eef4e5b91c6fa3e62d3301e3f73de..72eebde5b70043f670ab68b5c053557131caa598 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -75,3 +75,7 @@ [[constraint]] name = "github.com/xanzy/go-gitlab" version = "0.20.0" + +[[constraint]] + branch = "master" + name = "golang.org/x/sync" diff --git a/bridge/core/export.go b/bridge/core/export.go index 55cf5a603ad5da64043ea32d6591f36e1840eae5..ceae14017766184c0ffe05881f83820ff4639a96 100644 --- a/bridge/core/export.go +++ b/bridge/core/export.go @@ -46,9 +46,9 @@ func (er ExportResult) String() string { return fmt.Sprintf("changed label: %s", er.ID) case ExportEventNothing: if er.ID != "" { - return fmt.Sprintf("ignoring export event %s: %s", er.ID, er.Reason) + return fmt.Sprintf("no actions taken for event %s: %s", er.ID, er.Reason) } - return fmt.Sprintf("ignoring export event: %s", er.Reason) + return fmt.Sprintf("no actions taken: %s", er.Reason) case ExportEventError: if er.ID != "" { return fmt.Sprintf("export error at %s: %s", er.ID, er.Err.Error()) diff --git a/bridge/core/import.go b/bridge/core/import.go index 0961e00bffe5c097fc7ac3f6d6071f4646616cb8..cff30f613b50297a5f97a5c252d78813bb0cd3fb 100644 --- a/bridge/core/import.go +++ b/bridge/core/import.go @@ -49,9 +49,9 @@ func (er ImportResult) String() string { return fmt.Sprintf("new identity: %s", er.ID) case ImportEventNothing: if er.ID != "" { - return fmt.Sprintf("ignoring import event %s: %s", er.ID, er.Reason) + return fmt.Sprintf("no action taken for event %s: %s", er.ID, er.Reason) } - return fmt.Sprintf("ignoring event: %s", er.Reason) + return fmt.Sprintf("no action taken: %s", er.Reason) case ImportEventError: if er.ID != "" { return fmt.Sprintf("import error at id %s: %s", er.ID, er.Err.Error()) diff --git a/bridge/github/import.go b/bridge/github/import.go index 9fef9cb55f65b3668e991c88bda851d629d18a46..7c4deb50ed916f73e5236045155cd6803ddac0e1 100644 --- a/bridge/github/import.go +++ b/bridge/github/import.go @@ -369,8 +369,7 @@ func (gi *githubImporter) ensureTimelineComment(repo *cache.RepoCache, b *cache. targetOpID, err := b.ResolveOperationWithMetadata(keyGithubId, parseId(item.Id)) if err == nil { - reason := fmt.Sprintf("comment already imported") - gi.out <- core.NewImportNothing("", reason) + gi.out <- core.NewImportNothing("", "comment already imported") } else if err != cache.ErrNoMatchingOp { // real error return err diff --git a/bridge/gitlab/import.go b/bridge/gitlab/import.go index 40ac06d3935ab5bcb0e199b994d59a73f492e11a..1391bf8847aec09a4b925d678f21c76dd65b0392 100644 --- a/bridge/gitlab/import.go +++ b/bridge/gitlab/import.go @@ -99,8 +99,7 @@ func (gi *gitlabImporter) ensureIssue(repo *cache.RepoCache, issue *gitlab.Issue // resolve bug b, err := repo.ResolveBugCreateMetadata(keyGitlabUrl, issue.WebURL) if err == nil { - reason := fmt.Sprintf("bug already imported") - gi.out <- core.NewImportNothing("", reason) + gi.out <- core.NewImportNothing("", "bug already imported") return b, nil } if err != bug.ErrBugNotExist { diff --git a/vendor/golang.org/x/sync/AUTHORS b/vendor/golang.org/x/sync/AUTHORS new file mode 100644 index 0000000000000000000000000000000000000000..15167cd746c560e5b3d3b233a169aa64d3e9101e --- /dev/null +++ b/vendor/golang.org/x/sync/AUTHORS @@ -0,0 +1,3 @@ +# This source code refers to The Go Authors for copyright purposes. +# The master list of authors is in the main Go distribution, +# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/sync/CONTRIBUTORS b/vendor/golang.org/x/sync/CONTRIBUTORS new file mode 100644 index 0000000000000000000000000000000000000000..1c4577e9680611383f46044d17fa343a96997c3c --- /dev/null +++ b/vendor/golang.org/x/sync/CONTRIBUTORS @@ -0,0 +1,3 @@ +# This source code was written by the Go contributors. +# The master list of contributors is in the main Go distribution, +# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/golang.org/x/sync/LICENSE b/vendor/golang.org/x/sync/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..6a66aea5eafe0ca6a688840c47219556c552488e --- /dev/null +++ b/vendor/golang.org/x/sync/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/sync/PATENTS b/vendor/golang.org/x/sync/PATENTS new file mode 100644 index 0000000000000000000000000000000000000000..733099041f84fa1e58611ab2e11af51c1f26d1d2 --- /dev/null +++ b/vendor/golang.org/x/sync/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/sync/errgroup/errgroup.go b/vendor/golang.org/x/sync/errgroup/errgroup.go new file mode 100644 index 0000000000000000000000000000000000000000..9857fe53d3c91c527ee9b363df2c6d3ed8c52576 --- /dev/null +++ b/vendor/golang.org/x/sync/errgroup/errgroup.go @@ -0,0 +1,66 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package errgroup provides synchronization, error propagation, and Context +// cancelation for groups of goroutines working on subtasks of a common task. +package errgroup + +import ( + "context" + "sync" +) + +// A Group is a collection of goroutines working on subtasks that are part of +// the same overall task. +// +// A zero Group is valid and does not cancel on error. +type Group struct { + cancel func() + + wg sync.WaitGroup + + errOnce sync.Once + err error +} + +// WithContext returns a new Group and an associated Context derived from ctx. +// +// The derived Context is canceled the first time a function passed to Go +// returns a non-nil error or the first time Wait returns, whichever occurs +// first. +func WithContext(ctx context.Context) (*Group, context.Context) { + ctx, cancel := context.WithCancel(ctx) + return &Group{cancel: cancel}, ctx +} + +// Wait blocks until all function calls from the Go method have returned, then +// returns the first non-nil error (if any) from them. +func (g *Group) Wait() error { + g.wg.Wait() + if g.cancel != nil { + g.cancel() + } + return g.err +} + +// Go calls the given function in a new goroutine. +// +// The first call to return a non-nil error cancels the group; its error will be +// returned by Wait. +func (g *Group) Go(f func() error) { + g.wg.Add(1) + + go func() { + defer g.wg.Done() + + if err := f(); err != nil { + g.errOnce.Do(func() { + g.err = err + if g.cancel != nil { + g.cancel() + } + }) + } + }() +}