OLD | NEW |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package main | 5 package main |
6 | 6 |
7 import ( | 7 import ( |
8 "fmt" | 8 "fmt" |
9 "os" | 9 "os" |
10 "os/exec" | 10 "os/exec" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 if strings.HasSuffix(file, "_test.go") { | 51 if strings.HasSuffix(file, "_test.go") { |
52 // goFilesPackage is going to assign this to TestGoFiles
. | 52 // goFilesPackage is going to assign this to TestGoFiles
. |
53 // Reject since it won't be part of the build. | 53 // Reject since it won't be part of the build. |
54 fatalf("go run: cannot run *_test.go files (%s)", file) | 54 fatalf("go run: cannot run *_test.go files (%s)", file) |
55 } | 55 } |
56 } | 56 } |
57 p := goFilesPackage(files) | 57 p := goFilesPackage(files) |
58 if p.Error != nil { | 58 if p.Error != nil { |
59 fatalf("%s", p.Error) | 59 fatalf("%s", p.Error) |
60 } | 60 } |
| 61 p.omitDWARF = true |
61 for _, err := range p.DepsErrors { | 62 for _, err := range p.DepsErrors { |
62 errorf("%s", err) | 63 errorf("%s", err) |
63 } | 64 } |
64 exitIfErrors() | 65 exitIfErrors() |
65 if p.Name != "main" { | 66 if p.Name != "main" { |
66 fatalf("go run: cannot run non-main package") | 67 fatalf("go run: cannot run non-main package") |
67 } | 68 } |
68 p.target = "" // must build - not up to date | 69 p.target = "" // must build - not up to date |
69 var src string | 70 var src string |
70 if len(p.GoFiles) > 0 { | 71 if len(p.GoFiles) > 0 { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 cmdline := stringList(cmdargs...) | 106 cmdline := stringList(cmdargs...) |
106 cmd := exec.Command(cmdline[0], cmdline[1:]...) | 107 cmd := exec.Command(cmdline[0], cmdline[1:]...) |
107 cmd.Stdin = os.Stdin | 108 cmd.Stdin = os.Stdin |
108 cmd.Stdout = os.Stdout | 109 cmd.Stdout = os.Stdout |
109 cmd.Stderr = os.Stderr | 110 cmd.Stderr = os.Stderr |
110 startSigHandlers() | 111 startSigHandlers() |
111 if err := cmd.Run(); err != nil { | 112 if err := cmd.Run(); err != nil { |
112 errorf("%v", err) | 113 errorf("%v", err) |
113 } | 114 } |
114 } | 115 } |
OLD | NEW |