Giter VIP home page Giter VIP logo

go-find-references's Introduction

go-find-references

Find all References of an Identifier in a Codebase

Install

go install

Usage

go-find-references [flags]

flags:

-file [string]: the complete path of the file that contains the identifier.
-offset [int]: the byte offset of the identifier in the above file.
-line [int]: the line number of the identifier in the file.
-column [int]: the column number of the identifier in the file.
-root [string]: the directory in which to search for references (optional). If omitted, the directory containing file will be used.

For each found reference, the program will output two lines of text:
The first line contains the path of the file relative to root followed by :lineNumber. The second line contains the (trimmed) source text line containing the reference.

example output:

go-find-references -file /usr/lib/go/src/pkg/sort/search.go -offset 2254

/usr/share/go/src/pkg/sort/search.go:59:6 func Search(n int, f func(int) bool) int { /usr/share/go/src/pkg/sort/search.go:84:9 return Search(len(a), func(i int) bool { return a[i] >= x }) /usr/share/go/src/pkg/sort/search.go:93:9 return Search(len(a), func(i int) bool { return a[i] >= x }) /usr/share/go/src/pkg/sort/search.go:102:9 return Search(len(a), func(i int) bool { return a[i] >= x })

TODOs:

  • Improve error messages
  • Add support for non-expression identifiers (e.g. keys in struct initialization)

go-find-references's People

Contributors

lukehoban avatar redefiance avatar xujiahua avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.