goanalysis

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package goanalysis provides Go type-aware analysis via go/types.

ConvertToCallGraph and MergeCallGraphs have moved to the callgraph package to avoid a circular dependency. Import callgraph directly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasGoModule

func HasGoModule(dir string) bool

HasGoModule checks if dir contains a go.mod file.

Types

type LoadOpts

type LoadOpts struct {
	Patterns []string      // package patterns to load (default: "./...")
	Timeout  time.Duration // override default 60s timeout
}

LoadOpts configures package loading.

type LoadResult

type LoadResult struct {
	Packages []*packages.Package
	Errors   []string // non-fatal errors
}

LoadResult contains loaded packages with full type information.

func LoadPackages

func LoadPackages(ctx context.Context, dir string, opts LoadOpts) (*LoadResult, error)

type TypedEdge

type TypedEdge struct {
	CallerName   string // function containing the call
	CallerFile   string // absolute path
	CallerLine   uint32 // line of the caller function definition
	CalleeName   string // called function/method name
	CalleeFile   string // absolute path (empty if external)
	CalleePkg    string // package path of callee
	ReceiverType string // receiver type for method calls (empty for functions)
	Line         uint32 // line of the call site
	IsInterface  bool   // true if this is interface dispatch
}

TypedEdge is a call edge with full type information from the Go compiler.

func Resolve

func Resolve(pkgs []*packages.Package) []TypedEdge

Resolve walks loaded packages and extracts type-aware call edges.

Jump to

Keyboard shortcuts

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