package main import ( "encoding/json" "fmt" "ollie/tools/codeintel/internal/codeintel" "os" "path/filepath" ) type args struct { Path string `json:"path"` Query string `json:"query"` } func main() { var a struct { Path string `json:"path"` Query string `json:"query"` } if err := json.NewDecoder(os.Stdin).Decode(&a); err != nil { fail(err) } root, err := filepath.Abs(a.Path) if err != nil { fail(err) } ss, err := codeintel.MatchSymbols(root, a.Query) if err != nil { fail(err) } for _, s := range ss { fmt.Printf("%s:%d: %s [%s]\n", s.Path, s.Line, s.Name, s.Kind) } } func fail(e error) { fmt.Fprintln(os.Stderr, "error:", e); os.Exit(1) }