utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package utils contains various utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecomposeField added in v0.1.5

func DecomposeField(t types.Type, field int) (typePath, typeName, fieldName string)

DecomposeField returns the decomposed type of the struct containing the field, as well as the field's name. If the referenced struct's type is not a named type, the type path and name will both be empty strings.

func DecomposeFunction added in v0.1.5

func DecomposeFunction(f *ssa.Function) (path, recv, name string)

DecomposeFunction returns the path, receiver, and name strings of a ssa.Function. For functions that have no receiver, returns an empty string for recv. For shared functions (wrappers and error.Error), returns an empty string for path. Panics if provided a nil argument.

func DecomposeType added in v0.1.5

func DecomposeType(t types.Type) (path, name string)

DecomposeType returns the path and name of a Named type Returns empty strings if the type is not *types.Named

func Dereference

func Dereference(t types.Type) types.Type

Dereference returns the underlying type of a pointer. If the input is not a pointer, then the type of the input is returned.

func UnqualifiedName added in v0.1.5

func UnqualifiedName(t *types.Var) string

UnqualifiedName returns the name of the given type, without the qualifying prefix containing the package in which it was declared. Example: for a type named T declared in package p, the returned string will be just `T` instead of `p.T`.

Types

This section is empty.

Jump to

Keyboard shortcuts

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