Got it.

On Thu, Oct 13, 2022 at 7:13 AM Ian Lance Taylor <i...@golang.org> wrote:

> On Tue, Oct 11, 2022 at 8:42 PM Jingguo Yao <yaojing...@gmail.com> wrote:
> >
> > I have the following directory layout:
> >
> > ├── bar
> > │   └── bar_test.go
> > ├── foo
> > │   └── foo_test.go
> > ├── go.mod
> > └── go.sum
> >
> >
> > foo_test.go:
> > package main
> >
> > import (
> >     "fmt"
> >     "testing"
> > )
> >
> > func TestHelloWorld(t *testing.T) {
> >     fmt.Println("hello, foo")
> >     t.Log("hi, foo")
> > }
> >
> > bar_test.go:
> > package bar
> >
> > import (
> >     "fmt"
> >     "testing"
> > )
> >
> > func TestGreeting(t *testing.T) {
> >     fmt.Println("hello, bar")
> >     t.Log("hi, bar")
> > }
> >
> >
> > $ go test -count=1 -v ./...
> > === RUN   TestGreeting
> > hello, bar
> >     bar_test.go:10: hi, bar
> > --- PASS: TestGreeting (0.00s)
> > PASS
> > ok      yao.org/lang/bar    0.814s
> > === RUN   TestHelloWorld
> > hello, foo
> >     foo_test.go:10: hi, foo
> > --- PASS: TestHelloWorld (0.00s)
> > PASS
> > ok      yao.org/lang/foo    0.518s
> >
> > $ go test -count=1  ./...
> > ok      yao.org/lang/bar    0.115s
> > ok      yao.org/lang/foo    0.210s
> >
> > foo$ go test -v -count=1
> > === RUN   TestHelloWorld
> > hello, foo
> >     foo_test.go:10: hi, foo
> > --- PASS: TestHelloWorld (0.00s)
> > PASS
> > ok      yao.org/lang/foo    0.271s
> >
> > foo$ go test -count=1
> > hello, foo
> > PASS
> > ok      yao.org/lang/foo    0.105s
> >
> > I found the following different effects on two test modes by -v flag.
> >
> > 1. -v enables the output of fmt.Println and T.Log statements in package
> list mode.
> > 2. -v enables the output of T.Log statements in local directory mode.
> >
> > I browsed https://pkg.go.dev/cmd/go. But I failed to find a description
> of
> > this difference. Does this difference work as designed? If yes, can we
> document
> > it explicitly?
>
> I don't think we want to lock ourselves into the current behavior if
> we can avoid it.  We may find reasons to change it over time.
>
> (That said I wouldn't be surprised if changing this behavior broke
> some people's use cases.)
>
> Ian
>


-- 
Jingguo

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CANPB7a54HMSYgoo01sQJJhAnnLKFOJwOOYcuSDt6%2BPnaYNUhEQ%40mail.gmail.com.

Reply via email to