Source File
gotrack.go
Belonging Package
golang.org/x/net/http2
package http2
import (
)
var DebugGoroutines = os.Getenv("DEBUG_HTTP2_GOROUTINES") == "1"
type goroutineLock uint64
func () goroutineLock {
if !DebugGoroutines {
return 0
}
return goroutineLock(curGoroutineID())
}
func ( goroutineLock) () {
if !DebugGoroutines {
return
}
if curGoroutineID() != uint64() {
panic("running on the wrong goroutine")
}
}
func ( goroutineLock) () {
if !DebugGoroutines {
return
}
if curGoroutineID() == uint64() {
panic("running on the wrong goroutine")
}
}
var goroutineSpace = []byte("goroutine ")
func () uint64 {
:= littleBuf.Get().(*[]byte)
defer littleBuf.Put()
:= *
= bytes.TrimPrefix(, goroutineSpace)
:= bytes.IndexByte(, ' ')
if < 0 {
panic(fmt.Sprintf("No space found in %q", ))
}
= [:]
, := parseUintBytes(, 10, 64)
if != nil {
panic(fmt.Sprintf("Failed to parse goroutine ID out of %q: %v", , ))
}
return
}
var littleBuf = sync.Pool{
New: func() interface{} {
:= make([]byte, 64)
return &
},
}
switch {
case [0] == '0' && len() > 1 && ([1] == 'x' || [1] == 'X'):
= 16
= [2:]
if len() < 1 {
= strconv.ErrSyntax
goto
}
case [0] == '0':
= 8
default:
= 10
}
default:
= errors.New("invalid base " + strconv.Itoa())
goto
}
= 0
= cutoff64()
= 1<<uint() - 1
for := 0; < len(); ++ {
var byte
:= []
switch {
case '0' <= && <= '9':
= - '0'
case 'a' <= && <= 'z':
= - 'a' + 10
case 'A' <= && <= 'Z':
= - 'A' + 10
default:
= 0
= strconv.ErrSyntax
goto
}
if int() >= {
= 0
= strconv.ErrSyntax
goto
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |