scparser

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MIT Imports: 8 Imported by: 0

README

Source code parser

The parser takes a function name and package path as an argument and returns the source code of the function and its underlying functions (up to a depth of 5). The parser relies on the Abstract Syntax Tree (AST) and type information of the Go code to find and process the functions. It handles packages listed in the go.mod file, and processes only the functions declared in those packages.

Known limitations:

  • Requires go mod
  • Ignores interface methods

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(funcPkgPath, funcName string, excludeRoot, codeOnly bool) string

Parse retrieves the source code of the specified function and its underlying functions within the Go module packages. It takes the package path and function name as input arguments and returns a formatted string containing the combined source code. The function will panic if the provided function is not found in the package path.

Types

This section is empty.

Jump to

Keyboard shortcuts

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