MCPcopy Create free account
hub / github.com/php/frankenphp / extractGoFunctionName

Function extractGoFunctionName

internal/extgen/gofile.go:132–150  ·  view source on GitHub ↗

extractGoFunctionName extracts the Go function name from a Go function signature string.

(goFunction string)

Source from the content-addressed store, hash-verified

130
131// extractGoFunctionName extracts the Go function name from a Go function signature string.
132func extractGoFunctionName(goFunction string) string {
133 idx := strings.Index(goFunction, "func ")
134 if idx == -1 {
135 return ""
136 }
137
138 start := idx + len("func ")
139
140 end := start
141 for end < len(goFunction) && goFunction[end] != '(' {
142 end++
143 }
144
145 if end >= len(goFunction) {
146 return ""
147 }
148
149 return strings.TrimSpace(goFunction[start:end])
150}
151
152// extractGoFunctionSignatureParams extracts the parameters from a Go function signature.
153func extractGoFunctionSignatureParams(goFunction string) string {

Callers 2

Calls

no outgoing calls

Tested by 2