analyzer

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package analyzer provides utilities for loading and analyzing Go packages.

Index

Constants

This section is empty.

Variables

View Source
var ErrPackagesContainErrors = errors.New("packages contain errors")

ErrPackagesContainErrors is returned when loaded packages have errors.

Functions

func CollectSymbols

func CollectSymbols(pkg *packages.Package) (defined, used map[string]types.Object)

CollectSymbols extracts symbol definitions and usages from a package. Returns two maps: defined symbols and used symbols from other packages.

func LoadPackages

func LoadPackages(dir string, overlay map[string][]byte, patterns ...string) ([]*packages.Package, error)

LoadPackages loads Go packages with full type information.

func ObjectKind

func ObjectKind(obj types.Object) string

ObjectKind returns a string representation of the object kind.

Types

type Symbol

type Symbol struct {
	ID      string         // "pkg/path.SymbolName".
	Name    string         // Symbol name.
	Package string         // Package path.
	Kind    string         // "func", "type", "var", "const".
	File    string         // Defining file path.
	Pos     token.Position // Source position.
}

Symbol represents a symbol (function, type, variable, constant) in Go code.

Jump to

Keyboard shortcuts

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