parser

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadPackages

func LoadPackages(cfg LoadConfig) (types.PackageMap, error)

LoadPackages parses Golang packages using AST.

func PackageNameOfDir

func PackageNameOfDir(srcDir string) (string, error)

PackageNameOfDir get package import path via dir

func UpdatePackages

func UpdatePackages(p types.PackageMap, cfg LoadConfig) error

UpdatePackages updates the packages in the given PackageMap. The function would get and parse only packages that doesn't currently exists in given map.

Types

type LoadConfig

type LoadConfig struct {
	// Paths could be absolute or relative path to given directory.
	Paths []string
	// PkgNames should be full pkg name i.e.: 'golang.org/x/mod/modfile'
	PkgNames []string
	// BuildFlags are the flags used by the ast.
	BuildFlags []string
	// Verbose sets the loader in verbose mode.
	Verbose bool
	// WithComments
	WithComments bool
}

LoadConfig contains configuration used while loading packages.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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