Skip to content

bwsd0/dslice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dslice

dslice computes a static program slice of Go source code. Given a set of root symbols (functions, types, methods, constants, or variables), it extracts the minimal syntactic subset of the program required to compile those roots.

Dependencies on internal packages are resolved recursively and inlined into the output.

Usage

dslice [flags] <symbol>

Flags:
  -o string    output file (default: stdout)
  -name string output package name (default: inferred)

Examples

$ dslice fmt.Println
$ dslice golang.org/x/tools/go/packages.Package
$ dslice net/http.Client.Do
$ dslice -o slice.go encoding/json.Marshal

Limitations

Static analysis only. No guarantees for reflection, interface dispatch, or plugins.

References

M. Weiser, "Program Slicing," Proceedings of the 5th International Conference on Software Engineering, pp. 439-449, IEEE Press, 1981. https://dl.acm.org/doi/10.5555/800078.802557

About

Static program slicer for Go

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages