aicoded.dev

E-LINT-005: for generated code only

Some functions of the building blocks exist only for the code that aicoded generate writes, which calls them in the right order, with the checks around them: rpc.Call, rpc.DecodeError, rpc.NewServer, web.CheckNoGuard, web.DecodeArgs, web.LogError, web.New, web.Request.CSRFToken, form.BaseFormValues.MarkValidated, form.BaseFormValues.Prepare, form.BaseFormValues.SetElements, form.IsMultipart, the Process method of every form field (form.File.Process, form.FileMultiple.Process, form.Input.Process, form.InputMultiple.Process, form.Select.Process, form.SelectMultiple.Process and form.Textarea.Process), reactive.Accept, reactive.Decode, reactive.HTMLBinding and reactive.TextBinding. Their go doc says "Generated code only." Hand-written code may not call them, nor call a method of an interface with the same name and signature, where a type parameter in its signature stands for any type, which reaches the same method. Nor may it use an unexported name that a generated file declares, such as a page's state, its live connection or its route key: only the generated code uses them. A template cannot name the package-level names of its page's generated files either (E-GEN-042). Call another app through its generated client in services/<app>/, and use the exported names of generated files, such as RouteData, ReactiveState and NewHandler.

Fix: remove the call or the name: the code aicoded generate writes makes that call, and app code uses the exported names of that code.

Markdown · Source on GitHub · framework f46741f