<p dir="auto">by <strong>dahankzter</strong>:</p>
<pre class="notranslate">A Fresh clone of the repo leads to this during install with 'all.bash'

All my programs (for testing and playing around) works fine.
Its just this test that fail.

Install test-phase fails with this output:

6g -o _gotest_.6 client.go fs.go request.go server.go status.go url.go   
client_test.go request_test.go url_test.go
rm -f _test/http.a
gopack grc _test/http.a _gotest_.6 
make[2]: Leaving directory `/opt/go/src/pkg/http'
--- FAIL: http.TestRedirect
    Get <a href="http://codesearch.google.com/" rel="nofollow">http://codesearch.google.com/</a>: dial tcp codesearch.google.com:http:
lookup codesearch.google.com. on 192.168.0.1:53: no answer from server
FAIL
make[1]: *** [test] Error 1
make[1]: Leaving directory `/opt/go/src/pkg/http'
make: *** [http.test] Error 2

Environment and repo info:
GOOS=linux
COARCH=amd64

changeset:   4052:b72ec78019b4
tag:         tip
user:        Russ Cox &lt;rsc@golang.org&gt;
date:        Sun Nov 15 00:00:05 2009 -0800
summary:     cc: drop redundant strcpy</pre>
<pre class="notranslate">I spent some time on GopherCon trying to figure how to make the qml package work
smoothly on Mac OS. Apparently it was working fine out of luck, because the OS requires
some calls to be made from the initial thread. Now something unrelated was touched, and
the graphic goroutine is landing on a different thread and generating errors.

The solution is simple: an init function that locks the main thread, and a qml.Run
function that runs the main loop. Problem solved.

Except, that doesn't work with the testing package anymore, because the test logic
itself is run at the end of main, and tests are moved on their own goroutine.

This problem might be easily solved by changing the test template from:

  testing.Main(matchString, tests, benchmarks, examples)

to something like:

  go func() {
          testing.Main(matchString, tests, benchmarks, examples)
          close(done)
  }()
  if testing.RunFromMain != nil {
          testing.RunFromMain(done)
  }
  &lt;-done

Then, for the qml package, I'd implement RunFromMain along the lines of:

  testing.RunFromMain = func(done chan struct{}) {
          stopWhenClosed(done)
          qml.Run(nil)
  }

Can we add such a testing.RunFromMain hook?

Another alternative, suggested by Dmitry Vyukov, is to run tests on the initial thread
instead of spawning them in goroutines. That would solve the problem too.</pre>