MCPcopy Index your code
hub / github.com/labstack/echo / waitForServerStart

Function waitForServerStart

server_test.go:45–64  ·  view source on GitHub ↗
(addrChan <-chan string, errCh <-chan error)

Source from the content-addressed store, hash-verified

43}
44
45func waitForServerStart(addrChan <-chan string, errCh <-chan error) (string, error) {
46 waitCtx, cancel := stdContext.WithTimeout(stdContext.Background(), 200*time.Millisecond)
47 defer cancel()
48
49 // wait for addr to arrive
50 for {
51 select {
52 case <-waitCtx.Done():
53 return "", waitCtx.Err()
54 case addr := <-addrChan:
55 return addr, nil
56 case err := <-errCh:
57 if err == http.ErrServerClosed { // was closed normally before listener callback was called. should not be possible
58 return "", nil
59 }
60 // failed to start and we did not manage to get even listener part.
61 return "", err
62 }
63 }
64}
65
66func doGet(url string) (int, string, error) {
67 resp, err := http.Get(url)

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…