{"record":{"id":"65d59f4055a45982","repo":"hyperledger/fabric","slug":"unable-to-find-sampleconfig-directory-on-gopath","errorCode":null,"errorMessage":"unable to find sampleconfig directory on GOPATH","messagePattern":"unable to find sampleconfig directory on GOPATH","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/config/configtest/config.go","lineNumber":70,"sourceCode":"}\n\nfunc gopathDevConfigDir() (string, error) {\n\tbuf := bytes.NewBuffer(nil)\n\tcmd := exec.Command(\"go\", \"env\", \"GOPATH\")\n\tcmd.Stdout = buf\n\tif err := cmd.Run(); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tgopath := strings.TrimSpace(buf.String())\n\tfor _, p := range filepath.SplitList(gopath) {\n\t\tdevPath := filepath.Join(p, \"src/github.com/hyperledger/fabric/sampleconfig\")\n\t\tif dirExists(devPath) {\n\t\t\treturn devPath, nil\n\t\t}\n\t}\n\n\treturn \"\", errors.New(\"unable to find sampleconfig directory on GOPATH\")\n}\n\nfunc gomodDevConfigDir() (string, error) {\n\tbuf := bytes.NewBuffer(nil)\n\tcmd := exec.Command(\"go\", \"env\", \"GOMOD\")\n\tcmd.Stdout = buf\n\n\tif err := cmd.Run(); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tmodFile := strings.TrimSpace(buf.String())\n\tif modFile == \"\" {\n\t\treturn \"\", errors.New(\"not a module or not in module mode\")\n\t}\n\n\tdevPath := filepath.Join(filepath.Dir(modFile), \"sampleconfig\")\n\tif !dirExists(devPath) {","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/config/configtest/config.go#L52-L88","documentation":"gopathDevConfigDir scanned every GOPATH entry for src/github.com/hyperledger/fabric/sampleconfig and found none. This dev-only helper locates the in-tree sample configuration; absence means the source tree is not on GOPATH.","triggerScenarios":"Thrown at core/config/configtest/config.go:70 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use Go module mode so gomodDevConfigDir resolves the sampleconfig dir next to go.mod","Clone the fabric source into a GOPATH workspace","Copy sampleconfig manually and point the test at it"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}