A fork of deadcode.go by Remy Oudompheng. It's still useful even though there are a few broken bits now that go has evolved to 1.4.2 (at time of writing). See the godoc portion below for a list of changes I made to code.
If you have a working go installation on a Unix-like OS:
go get github.com/hotei/deadcode
That will copy github.com/hotei/deadcode to the first entry of your $GOPATH
or if go is not installed yet :
cd DestinationDirectory
git clone https://github.com/hotei/deadcode.git
- simple
- works as intended
- friendly to markdown (new feature)
- works well in Makefile (new feature)
- deadcode will ignore build tags that might be present in the programs being checked
- [ed. Hotei] in time I hope to correct this but it's not urgent
cd to the directory of the program you wish to check and run it
$ cd progDir
$ deadcode
or
$ deadcode someDirectory
- none known
- 2015-08-09 compiled with 1.5rc1
- 2015-06-12 compiled with 1.4
- 2014-xx-xx Started
Comments can be sent to hotei1352@gmail.com or to user "hotei" at github.com. My license is BSD-two-clause, in file "LICENSE.md"
The original source to deadcode was copyrighted with this BSD-3 license
Copyright (c) 2012 Rémy Oudompheng. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* The name of Rémy Oudompheng may not be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Documentation (c) 2014-2015 David Rook
DO NOT EDIT BELOW - Generated by godoc2md
deadcode.go (c) David Rook - original version (c) Remy Oudompheng
Changed the way program produces output so it goes to stdout vs stderr.
Changed exit code so it only produces an error code if program fails, not just because it found dead code.
These changes make it much more friendly when used in a makefile to create package/program documentation.
Added -md option to format output to be friendly to markdown parsers. Added -verbose option to get an idea of what's being scanned
Use -make=false if you want the original behavior
DO NOT EDIT ABOVE - Generated by godoc2md
github.com/hotei/deadcode imports
bytes
errors
flag
fmt
go/ast
go/parser
go/scanner
go/token
io
io/ioutil
math
os
path/filepath
reflect
runtime
sort
strconv
strings
sync
sync/atomic
syscall
time
unicode
unicode/utf8
unsafe
deadcode results:
deadcode: deadcode.go:36:1: notused is unused