parser

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package parser contains utilities for parsing relevant library files, respecting build constraints and tracking go.mod files, imports and package names.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseDir

func ParseDir(fset *token.FileSet, dirPath string, modulePathHint string) (pkgs map[string]*Package, err error)

ParseDir recursively parses a single package directory from source code.

modulePathHint is the full package path (required if no go.mod is present). pkgs maps package path to Package.

func ParseDirModules

func ParseDirModules(fset *token.FileSet, dirPath, modulePathHint string) (goVer string, modules map[string]string, require []module.Version, err error)

ParseDirModules fetches package info from source code. It recursively parses a single package directory.

modulePathHint is the full package path (required if no go.mod is present). goVer is the semantic version of the module. modules maps package path to package name. require lists all dependencies of the parsed package.

Types

type Package

type Package struct {
	Name  string
	Path  string
	Files map[string]*ast.File
}

Jump to

Keyboard shortcuts

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