Skip to content

Latest commit

 

History

History
63 lines (46 loc) · 1.2 KB

README.md

File metadata and controls

63 lines (46 loc) · 1.2 KB

rdeadcode

Parse the output of deadcode and remove(rewrite) the dead code from the source files.

Installation

go install github.com/yyoshiki41/rdeadcode@latest

Usage

deadcode -json -test ./path/to/your/project | rdeadcode

or

rdeadcode -json deadcode.json

Independent features of rdeadcode

Pass the argument -file and -function to remove the dead code from the file.

rdeadcode -file path/to/your/file.go -function deadFunction

-help

$ rdeadcode -help
Usage of rdeadcode:
  -json string
    	JSON file generated by deadcode
  -file string
    	File to remove function from
  -function string
    	Function to remove
  -ignore string
    	Ignore files matching glob pattern

Known issues

Warning

deadcode detects methods that implement an interface as dead code if it is not used in the project.

Please verify the interface compliance at compile time and restore the method when rdeadcode removes it.

// Verify interface compliance at compile time
var _ fmt.Stringer = myString{}

type myString struct {
	Value string
}

func (s myString) String() string {
	return s.Value
}