dslice

command module
v0.0.0-...-d0c129d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2025 License: MIT Imports: 5 Imported by: 0

README

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

Documentation

Overview

dslice extracts minimal dependency slices from Go packages.

Usage:

dslice [flags] <symbol>

The symbol is a fully qualified Go symbol in the form:

package/path.Name
package/path.Type.Method

Examples:

dslice golang.org/x/tools/go/packages.Package
dslice golang.org/x/tools/go/packages.Load
dslice net/http.Client.Do

Directories

Path Synopsis
Package slice computes minimal dependency slices for Go declarations.
Package slice computes minimal dependency slices for Go declarations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL