cliutil

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: MIT Imports: 5 Imported by: 0

README

cliutil

Go Reference

Utilities for CLI tools of static analysis tools.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = &Config{
	Packages: &packages.Config{
		Mode: packages.NeedTypes,
	},
}

DefaultConfig is the default value of Config.

View Source
var (
	// ErrNotFound indicates the object or the type could not be found
	ErrNotFound = errors.New("not found")
)

Functions

func ObjectOf

func ObjectOf(name string) (types.Object, error)

ObjectOf is wrapper of DefaultConfig.ObjectOf(name).

func Split

func Split(name string) (first, second, third string, ptr bool)

Split splits name into three sections. The first section means a package name or a pre-declared identifier. The second section means an object of package. The third section means a field or a method. The fourth return value indicates whether name has "*" prefix or not.

func TypeOf

func TypeOf(name string) (types.Type, error)

TypeOf is wrapper of DefaultConfig.TypeOf(name).

Types

type Config

type Config struct {
	Packages *packages.Config
}

Config has configurations of static analysis.

func (*Config) ObjectOf

func (conf *Config) ObjectOf(name string) (types.Object, error)

ObjectOf returns the value of types.Object which represented by the name. If any object could not be found, ObjectOf returns ErrNotFound as the second return value.

func (*Config) TypeOf

func (conf *Config) TypeOf(name string) (types.Type, error)

TypeOf returns the value of types.Type which represented by the name. If any type could not be found, TypeOf returns ErrNotFound as the second return value.

Jump to

Keyboard shortcuts

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