Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/modules/matching/testhelp_test.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | internal/modules/matching/testhelp_test.go |
| Original SHA-256 | 90a8299cb47e83ea1ccbcb52401fc84971fc7fba336d169d45d5bcd1f145ac9a |
| Git blob SHA | 7c2fb03400d744b093f61669efdbc8f7bbd9d47a |
| Reading-copy SHA-256 | 90a8299cb47e83ea1ccbcb52401fc84971fc7fba336d169d45d5bcd1f145ac9a |
Recovered source transcript
Download complete source text ↓31 lines · 0.6 KB
package matching
import (
"os"
"strings"
"testing"
)
func readFile(t *testing.T, name string) string {
t.Helper()
b, err := os.ReadFile(name)
if err != nil {
t.Fatalf("read %s: %v", name, err)
}
return string(b)
}
// functionBody bounds one function's text for the structural guards. Crude, and sufficient: it only has to
// find where a function ends, and gofmt guarantees a top level func starts at column zero.
func functionBody(src, signature string) string {
i := strings.Index(src, signature)
if i < 0 {
return ""
}
rest := src[i+len(signature):]
if j := strings.Index(rest, "\nfunc "); j >= 0 {
return rest[:j]
}
return rest
}