Skip to content

Commit 169332e

Browse files
committed
fmt not log
1 parent e868aab commit 169332e

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

main.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func runList(ctx context.Context, args []string) error {
136136
continue
137137
}
138138

139-
log.Println(pkg.ImportPath)
139+
fmt.Println(pkg.ImportPath)
140140
for _, test := range tests {
141141
fmt.Printf(" %s\n", test)
142142
}
@@ -155,13 +155,13 @@ func runTest(ctx context.Context, args []string) error {
155155
}
156156
defer cleanup()
157157

158-
log.Printf("runTest opts=%s args=%s", JSON(opts), JSON(args))
158+
fmt.Printf("runTest opts=%s args=%s", JSON(opts), JSON(args))
159159
start := time.Now()
160160

161161
if opts.Timeout > 0 {
162162
go func() {
163163
<-time.After(opts.Timeout)
164-
log.Printf("FAIL: timed out after %s\n", time.Since(start))
164+
fmt.Printf("FAIL: timed out after %s\n", time.Since(start))
165165
panic(fmt.Sprintf("timed out after %s", time.Since(start)))
166166
}()
167167
}
@@ -187,7 +187,7 @@ func runTest(ctx context.Context, args []string) error {
187187
// compile test binary
188188
bin, err := compileTestBin(pkg, opts.TmpDir)
189189
if err != nil {
190-
log.Printf("FAIL\t%s\t[compile error: %v]\n", pkg.ImportPath, err)
190+
fmt.Printf("FAIL\t%s\t[compile error: %v]\n", pkg.ImportPath, err)
191191
return err
192192
}
193193

@@ -209,31 +209,31 @@ func runTest(ctx context.Context, args []string) error {
209209
args = append(args, "-test.run", fmt.Sprintf("^%s$", test))
210210
for i := opts.Retry; i >= 0; i-- {
211211
cmd := exec.Command(bin, args...)
212-
log.Println(cmd.String())
212+
fmt.Println(cmd.String())
213213
out, err := cmd.CombinedOutput()
214214
if err != nil {
215215
if i == 0 {
216-
log.Printf("FAIL\t%s.%s\t[test error: %v]\n", pkg.ImportPath, test, err)
216+
fmt.Printf("FAIL\t%s.%s\t[test error: %v]\n", pkg.ImportPath, test, err)
217217
isPackageOK = false
218218
atLeastOneFailure = true
219219
} else if opts.Verbose {
220-
log.Printf("RETRY\t%s.%s\t[test error: %v]\n", pkg.ImportPath, test, err)
220+
fmt.Printf("RETRY\t%s.%s\t[test error: %v]\n", pkg.ImportPath, test, err)
221221
}
222222
if opts.Verbose {
223-
log.Println(string(out))
223+
fmt.Println(string(out))
224224
}
225225
} else {
226-
log.Printf("ok\t%s.%s\n", pkg.ImportPath, test)
226+
fmt.Printf("ok\t%s.%s\n", pkg.ImportPath, test)
227227
break
228228
}
229229
}
230230
}
231231
if isPackageOK {
232-
log.Printf("ok\t%s\t%s\n", pkg.ImportPath, time.Since(pkgStart))
232+
fmt.Printf("ok\t%s\t%s\n", pkg.ImportPath, time.Since(pkgStart))
233233
}
234234
}
235235

236-
log.Printf("total: %s\n", time.Since(start))
236+
fmt.Printf("total: %s\n", time.Since(start))
237237
if atLeastOneFailure {
238238
return errors.New("at least one failure occurred")
239239
}
@@ -271,7 +271,7 @@ func compileTestBin(pkg Package, tempdir string) (string, error) {
271271
args = append(args, "-o", bin)
272272
cmd := exec.Command("go", args...)
273273
cmd.Dir = pkg.Dir
274-
log.Println(cmd.String())
274+
fmt.Println(cmd.String())
275275
out, err := cmd.CombinedOutput()
276276
if err != nil {
277277
fmt.Fprintln(os.Stderr, string(out))
@@ -284,7 +284,7 @@ func compileTestBin(pkg Package, tempdir string) (string, error) {
284284
func listDirTests(dir string) ([]string, error) {
285285
cmd := exec.Command("go", "test", "-list", ".")
286286
cmd.Dir = dir
287-
log.Println(cmd.String())
287+
fmt.Println(cmd.String())
288288
out, err := cmd.CombinedOutput()
289289
if err != nil {
290290
return nil, err
@@ -303,7 +303,7 @@ func listDirTests(dir string) ([]string, error) {
303303
}
304304

305305
if len(opts.Skip) > 0 {
306-
log.Println("skip", opts.Skip)
306+
fmt.Println("skip", opts.Skip)
307307
var filteredTests []string
308308
for _, test := range tests {
309309
shouldKeep := true
@@ -329,7 +329,7 @@ func listDirTests(dir string) ([]string, error) {
329329
}
330330

331331
if len(opts.Run) > 0 {
332-
log.Println("run", opts.Run)
332+
fmt.Println("run", opts.Run)
333333
var filteredTests []string
334334
for _, test := range tests {
335335
shouldKeep := false
@@ -360,7 +360,7 @@ func listDirTests(dir string) ([]string, error) {
360360
func listPackagesWithTests(patterns []string) ([]Package, error) {
361361
cmdArgs := append([]string{"list", "-test", "-f", "{{.ImportPath}} {{.Dir}}"}, patterns...)
362362
cmd := exec.Command("go", cmdArgs...)
363-
log.Println(cmd.String())
363+
fmt.Println(cmd.String())
364364
out, err := cmd.CombinedOutput()
365365
if err != nil {
366366
fmt.Fprintln(os.Stderr, string(out))

0 commit comments

Comments
 (0)