aichaos / rivescript-go

A RiveScript interpreter for Go. RiveScript is a scripting language for chatterbots.
https://www.rivescript.com/
MIT License
60 stars 16 forks source link

Related to #25 How to use SetSubroutine #32

Closed julianfrank closed 7 years ago

julianfrank commented 7 years ago
cannot find package "github.com/aichaos/rivescript-go/src" in any of:

github.com/aichaos/rivescript-go/src does not exist in current repo...and it does not work.. Whats the alternative?

julianfrank commented 7 years ago

Just noticed in godoc examples that I need to use *rivescript.RiveScript ...instead of rss.Rivescript and remove the rss import... closing this.

meowgorithm commented 7 years ago

Yep, at the moment, the top level package is an abstraction layer for the internal rivescript package. There are still times when you need to access the internal rivescript.RiveScript object, however, which is why it’s exported.

Just noting this here to aid future readers.

kirsle commented 7 years ago

Yeah. It used to be worse because I had the bulk of the code under /src to keep the root of the git repo tidy... and so the root package ended up becoming a wrapper around the src package, so it had its own RiveScript type that was distinct from the src.RiveScript type... and so for object macros you had to import the src version and it was extra confusing. (Go 1.9 type aliases may have solved the problem, but I've rearranged the source code by now anyway)

The new code layout is more similar to most other Go libraries that have a "main" type, and a .New() function that creates that type.