Coder Social home page Coder Social logo

andrewsmedina / pray Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fsouza/pray

0.0 0.0 0.0 132 KB

Tool for finding unused public pieces of Go code.

Home Page: https://godoc.org/github.com/fsouza/pray

License: BSD 2-Clause "Simplified" License

Go 100.00%

pray's Introduction

pray

Build Status GoDoc

pray is a tool for finding unused public variables, constants, types, functions and methods. Given a package, it will explore all public items in that package and check for the usage of these items in a set of specified packages. Here is a sample usage:

% pray -src github.com/tsuru/config github.com/tsuru/tsuru/app
/Users/f/src/github.com/tsuru/config/checker.go:10:6: Check is unused
/Users/f/src/github.com/tsuru/config/config.go:113:6: WriteConfigFile is unused
/Users/f/src/github.com/tsuru/config/config.go:229:6: GetUint is unused
/Users/f/src/github.com/tsuru/config/config.go:75:6: ReadAndWatchConfigFile is unused
/Users/f/src/github.com/tsuru/config/config.go:296:6: GetList is unused
/Users/f/src/github.com/tsuru/config/config.go:208:6: GetFloat is unused

The flag -src specifies the source packages, and then users can provide the set of packages for searching. Users can also use the Go notation for expanding subpackages:

% pray -src github.com/tsuru/config github.com/tsuru/tsuru/...

Current status

Currently, it works, but may eat your entire system memory. It also gives false negatives when analyzing public methods of a type that implement an interface, and the method is called only through the interface, so it still reports that MyError.Error is unused in the code below:

type MyError struct {
	message string
}

func (err *MyError) Error() string {
	return err.message
}

func getError() string {
	var err error = &MyError{}
	return err.Error()
}

Contributing

Feel free to send any pull requests or open issues. Please ensure that your code follow gofmt and goimports rules.

pray's People

Contributors

fsouza 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.