-
Notifications
You must be signed in to change notification settings - Fork 68
Support for Go #19
Comments
Looks like there's built-in support for C++ SWIG files if you rename the file to .swigcxx as in this example: https://github.com/golang/go/tree/master/misc/swig/callback SWIG must be installed as "go build" will call it when it gets to a .swigcxx file. Looks like at minimum the requirement is https://github.com/Kitt-AI/snowboy/tree/master/swig/Go which then exposed https://github.com/Kitt-AI/snowboy/blob/master/include/snowboy-detect.h as https://github.com/Kitt-AI/snowboy/blob/master/include/snowboy-detect.h The first example (callback) uses "Director" while the second (snowboy) does not. This is detailed here: swig/swig#418 (comment) Directors are a SWIG feature. More about SWIG with Go is at http://www.swig.org/Doc4.0/SWIGDocumentation.html#Go_basic_tour and directors at http://www.swig.org/Doc4.0/SWIGDocumentation.html#Go_director_classes |
It looks like though there's a nice go/ast package, the best docs for SourcetrailDB-ready analysis of Go programs is https://go.googlesource.com/example/+/HEAD/gotypes I started trying to copy and paste relevant documentation, but in true Go fashion, the entire document is concise and useful... though as might be expected, without the usual syntax highlighting and it's very, very long. For building a graph, we'll likely most care about Identifier Resolution https://go.googlesource.com/example/+/HEAD/gotypes#identifier-resolution This section includes example code which prints the location of each referring and defining identifier in the input program, and the object it refers to which it looks up by file position offset. Most likely what you'll want to do is visit the syntax tree and construct the mapping between declarations and objects. fset.Position(p) will be useful in converting from a file offset number to column/line number as documented at https://golang.org/pkg/go/token/#Pos and shown in an example from the gotypes documentation. |
I hate to be a bother, but is there any update on the status of this? |
I'm sorry to say that we haven't heard of anyone working on this currently. |
If anyone is interested, I found this (WIP) project here: https://github.com/TOMATOFAQ/SourcetrailGolangIndexer But the complete binding is not pushed (yet), at least the |
No description provided.
The text was updated successfully, but these errors were encountered: