(pkg string, p toolExecParams)
| 140 | } |
| 141 | |
| 142 | func (cmd *mainCmd) toolExecRewrite(pkg string, p toolExecParams) (exitCode int) { |
| 143 | // We only need to modify the arguments for "compile" calls which work with .go files. |
| 144 | if !isCompile(p.Tool) { |
| 145 | return cmd.runOriginal(p) |
| 146 | } |
| 147 | |
| 148 | // We only modify files that import errtrace, so stdlib is never eliglble. |
| 149 | if isStdLib(p.ToolArgs) { |
| 150 | return cmd.runOriginal(p) |
| 151 | } |
| 152 | |
| 153 | exitCode, err := cmd.rewriteCompile(pkg, p) |
| 154 | if err != nil { |
| 155 | cmd.log.Print(err) |
| 156 | return 1 |
| 157 | } |
| 158 | |
| 159 | return exitCode |
| 160 | } |
| 161 | |
| 162 | func (cmd *mainCmd) rewriteCompile(pkg string, p toolExecParams) (exitCode int, _ error) { |
| 163 | var canRewrite, needRewrite bool |
no test coverage detected