MCPcopy Index your code
hub / github.com/coder/coder / Write

Method Write

scripts/develop/main.go:1412–1429  ·  view source on GitHub ↗
(p []byte)

Source from the content-addressed store, hash-verified

1410}
1411
1412func (w *logWriter) Write(p []byte) (int, error) {
1413 w.mu.Lock()
1414 defer w.mu.Unlock()
1415
1416 w.buf = append(w.buf, p...)
1417 for {
1418 idx := bytes.IndexByte(w.buf, '\n')
1419 if idx < 0 {
1420 break
1421 }
1422 line := string(w.buf[:idx])
1423 w.buf = w.buf[idx+1:]
1424 if line != "" {
1425 w.logger.Info(context.Background(), line)
1426 }
1427 }
1428 return len(p), nil
1429}
1430
1431func isPortBusy(ctx context.Context, port int64) bool {
1432 d := net.Dialer{Timeout: 2 * time.Second}

Callers 1

TestLogWriterFunction · 0.95

Calls 3

LockMethod · 0.45
UnlockMethod · 0.45
InfoMethod · 0.45

Tested by 1

TestLogWriterFunction · 0.76