{"record":{"id":"2e6de53c0a7f9a5a","repo":"flipped-aurora/gin-vue-admin","slug":"parent-plugin-does-not-implement-register","errorCode":null,"errorMessage":"parent plugin does not implement Register","messagePattern":"parent plugin does not implement Register","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/service/system/auto_code_plugin.go","lineNumber":618,"sourceCode":"\t\treturn errors.New(\"child plugin import cannot be blank or dot imported\")\n\t}\n\tif !imported {\n\t\timportSpec := &goast.ImportSpec{\n\t\t\tName: goast.NewIdent(alias),\n\t\t\tPath: &goast.BasicLit{Kind: token.STRING, Value: strconv.Quote(childImportPath)},\n\t\t}\n\t\tif importDecl := firstImportDeclaration(astFile); importDecl == nil {\n\t\t\tastFile.Decls = append([]goast.Decl{\n\t\t\t\t&goast.GenDecl{Tok: token.IMPORT, Specs: []goast.Spec{importSpec}},\n\t\t\t}, astFile.Decls...)\n\t\t} else {\n\t\t\timportDecl.Specs = append(importDecl.Specs, importSpec)\n\t\t}\n\t}\n\n\tregisterFunc := findPluginRegisterFunction(astFile)\n\tif registerFunc == nil {\n\t\treturn errors.New(\"parent plugin does not implement Register\")\n\t}\n\tif hasChildPluginRegisterCall(registerFunc.Body, alias) {\n\t\treturn nil\n\t}\n\tgroupName := \"group\"\n\tif registerFunc.Type.Params != nil && len(registerFunc.Type.Params.List) > 0 && len(registerFunc.Type.Params.List[0].Names) > 0 {\n\t\tgroupName = registerFunc.Type.Params.List[0].Names[0].Name\n\t}\n\tregisterFunc.Body.List = append(registerFunc.Body.List, &goast.ExprStmt{\n\t\tX: &goast.CallExpr{\n\t\t\tFun: &goast.SelectorExpr{\n\t\t\t\tX:   &goast.SelectorExpr{X: goast.NewIdent(alias), Sel: goast.NewIdent(\"Plugin\")},\n\t\t\t\tSel: goast.NewIdent(\"Register\"),\n\t\t\t},\n\t\t\tArgs: []goast.Expr{goast.NewIdent(groupName)},\n\t\t},\n\t})\n\treturn writeGoFile(parentPath, fileSet, astFile)","sourceCodeStart":600,"sourceCodeEnd":636,"githubUrl":"https://github.com/flipped-aurora/gin-vue-admin/blob/3136500ef380842b0eb6c4daa87c3f8a47fcf9e0/server/service/system/auto_code_plugin.go#L600-L636","documentation":"To register a child sub-plugin, the parent's plugin.go must expose a `Register` function (the installer locates it via findPluginRegisterFunction). If no such function exists in the parent's AST, the installer cannot append the child registration call and throws this error, meaning the parent is not a properly structured plugin entry.","triggerScenarios":"Installing a sub-plugin under a parent whose plugin.go lacks a `Register` function — e.g. the parent was hand-created without the standard plugin scaffold, or the Register function is defined in another file/package, or it was renamed.","commonSituations":"Parent generated from an old template with a differently-named entry function; developer refactored Register away or moved it; plugin.go replaced by a minimal stub; parent actually a plain library directory mislabeled as a plugin.","solutions":["Add a standard `Register(group *gin.RouterGroup)` function to the parent's plugin.go, delegating to any existing route setup.","Move or restore the Register function into plugin.go so the installer can find it in that file's AST.","Rename a non-standard entry function (e.g. SetupRoutes) back to Register with the expected signature.","Verify the parent was generated as a real plugin (via the code generator or template) rather than an empty directory with a stub plugin.go."],"exampleFix":"// before (parent plugin.go)\npackage parent\n// no Register function\n// after\npackage parent\n\nimport \"github.com/gin-gonic/gin\"\n\nfunc Register(group *gin.RouterGroup) {\n\t// parent routes...\n}","handlingStrategy":"validation","validationCode":"// precheck that parent plugin.go defines Register\nsrc, _ := os.ReadFile(path.Join(pluginRoot, parent, \"plugin.go\"))\nif !strings.Contains(string(src), \"func Register(\") {\n  return errors.New(\"parent plugin.go must define func Register(group *gin.RouterGroup)\")\n}","typeGuard":null,"tryCatchPattern":"if err := installSubPlugin(parent, child); err != nil {\n  if strings.Contains(err.Error(), \"does not implement Register\") {\n    log.Fatal(\"add func Register(group *gin.RouterGroup) to the parent's plugin.go\")\n  }\n  return err\n}","preventionTips":["Generate parent plugins with the standard template so Register always exists.","Do not rename or move the Register function out of plugin.go during refactors.","Keep parent plugins minimal scaffolds that delegate, so the entry contract stays intact."],"tags":["plugin-install","go-ast","codegen"],"backgroundTag":"missing-register-function","analyzedSha":"3136500ef380842b0eb6c4daa87c3f8a47fcf9e0","analyzedAt":"2026-08-31T13:50:02.721Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}