Skip to content

A library to get variable references from Go source code.

Notifications You must be signed in to change notification settings

akif999/go_references

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go_references

A library to get variable references from Go source code.

Usage

You can use this package like following code.

package main

import (
	"fmt"
	"log"

	references "github.com/akif999/go_references"
)

func main() {
	references := references.New()
	err := references.ParseFile("../testdata/a.go")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(references.File)
	for _, ref := range references.Refs {
		fmt.Printf("%s: %d\n", ref.Name, ref.Row)
	}
}

Installation

go install .github.com/akif999/go_references

TODO

  • Implementing parse processing
    • parse process (DONE)
    • exclude Keywords (e.g int, string, make...)
      • builtins (int, string, panic...) (DONE)
      • others
  • Explore APIs (DONE)
  • Add Context(under consideration)
    • ex. AssignStmt, StarExpr..
  • Add identifier map(under consideration)
    • e.g Hoge {{Line:11, Context: Assign}...}
  • add tests (to testdata/a.go)

License

MIT

Author

Akifumi Kitabatake(user name is "akif" or "akif999")

About

A library to get variable references from Go source code.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages