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

Unified Diff: tools/cmd/gorun/main.go

Issue 2963503003: [errors] Greatly simplify common/errors package. (Closed)
Patch Set: fix nits Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tokenserver/appengine/impl/utils/policy/policy.go ('k') | vpython/application/application.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/cmd/gorun/main.go
diff --git a/tools/cmd/gorun/main.go b/tools/cmd/gorun/main.go
index 1416b67b69a5bd9ccfc7abf49a3484f5d2394dc0..dc0dd8592bb2e19af263550d68a9b04d91a7107c 100644
--- a/tools/cmd/gorun/main.go
+++ b/tools/cmd/gorun/main.go
@@ -25,14 +25,14 @@ import (
func mainImpl(args []string) (int, error) {
if len(args) < 1 {
- return 1, errors.Reason("accepts one argument: package").Err()
+ return 1, errors.New("accepts one argument: package")
}
pkg, args := args[0], args[1:]
// Create a temporary output directory to build into.
tmpdir, err := ioutil.TempDir("", "luci-gorun")
if err != nil {
- return 1, errors.Annotate(err).Reason("failed to create temporary directory").Err()
+ return 1, errors.Annotate(err, "failed to create temporary directory").Err()
}
defer os.RemoveAll(tmpdir)
@@ -46,7 +46,7 @@ func mainImpl(args []string) (int, error) {
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
- return 1, errors.Annotate(err).Reason("failed to build: %(package)s").D("package", pkg).Err()
+ return 1, errors.Annotate(err, "failed to build: %s", pkg).Err()
}
// Run the package.
@@ -58,7 +58,7 @@ func mainImpl(args []string) (int, error) {
if rc, ok := exitcode.Get(err); ok {
return rc, nil
}
- return 1, errors.Annotate(err).Reason("failed to run: %(package)s").D("package", pkg).Err()
+ return 1, errors.Annotate(err, "failed to run: %s", pkg).Err()
}
return 0, nil
@@ -67,7 +67,9 @@ func mainImpl(args []string) (int, error) {
func main() {
rc, err := mainImpl(os.Args[1:])
if err != nil {
- _, _ = errors.RenderStack(err).DumpTo(os.Stderr)
+ for _, line := range errors.RenderStack(err) {
+ os.Stderr.WriteString(line + "\n")
+ }
}
os.Exit(rc)
}
« no previous file with comments | « tokenserver/appengine/impl/utils/policy/policy.go ('k') | vpython/application/application.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698