Skip to content

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

Notifications You must be signed in to change notification settings

yyoshiki41/rdeadcode

Repository files navigation

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
}

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages