You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a blanket ticket for going through the codebase and doing general cleanup and API fixes to make the code more idiomatic from a Go point of view.
Examples:
More functions should return error objects to communicate failure conditions rather than relying on "magic" return values like empty strings.
e.g. func ClearUservars(username string) error could return an error when the user had no vars to clear.
e.g. func CurrentUser() (string, error) where it gives an error when called outside of an object macro context, rather than what it currently does by returning an empty string -- this isn't idiomatic Go.
User variable getter functions should be refactored to make more sense for "API context" vs. "internal use w/ <get>"
The public API functions like GetUservar() should follow Go idioms and return "", error in case of errors rather than "undefined", error
The internal use of the functions for the <get> types of tags would handle the mapping of "" to "undefined" for their own use.
Find a way to make the constructor config object easier to get and use. It's stupid to need to import aichaos/rivescript-go/config to get the config.Config{} type for initializing RiveScript. The config type should be available directly from the parent package.
This might require refactoring to make the parent package include more logic for config handling rather than just proxying all methods through to the /src versions, but that's probably a good thing anyway. The /src package is private use only and I already spelled out in its docs that its API can be changed at any time without notice.
This is a blanket ticket for going through the codebase and doing general cleanup and API fixes to make the code more idiomatic from a Go point of view.
Examples:
More functions should return
errorobjects to communicate failure conditions rather than relying on "magic" return values like empty strings.func ClearUservars(username string) errorcould return an error when the user had no vars to clear.func CurrentUser() (string, error)where it gives an error when called outside of an object macro context, rather than what it currently does by returning an empty string -- this isn't idiomatic Go.User variable getter functions should be refactored to make more sense for "API context" vs. "internal use w/
<get>"GetUservar()should follow Go idioms and return"", errorin case of errors rather than"undefined", error<get>types of tags would handle the mapping of""to"undefined"for their own use.Find a way to make the constructor config object easier to get and use. It's stupid to need to import
aichaos/rivescript-go/configto get theconfig.Config{}type for initializing RiveScript. The config type should be available directly from the parent package.This might require refactoring to make the parent package include more logic for config handling rather than just proxying all methods through to the
/srcversions, but that's probably a good thing anyway. The/srcpackage is private use only and I already spelled out in its docs that its API can be changed at any time without notice.