Documentation
¶
Overview ¶
Original Copyright: 2014 The Go Authors. All rights reserved. Original source: https://raw.githubusercontent.com/golang/tools/master/cmd/callgraph/main.go Changes done by me, Avishkar Gupta <avgupta@redhat.com> according to my needs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Builtins = map[string]bool{ "append": true, "cap": true, "close": true, "complex": true, "copy": true, "delete": true, "imag": true, "len": true, "make": true, "new": true, "panic": true, "print": true, "println": true, "real": true, "recover": true, "ComplexType": true, "FloatType": true, "IntegerType": true, "Type": true, "Type1": true, "bool": true, "byte": true, "complex128": true, "complex64": true, "error": true, "float32": true, "float64": true, "int": true, "int16": true, "int32": true, "int64": true, "int8": true, "rune": true, "string": true, "uint": true, "uint16": true, "uint32": true, "uint64": true, "uint8": true, "uintptr": true, }
A map of all the builtins of the go programming language.
Functions ¶
Types ¶
type CodePath ¶
type CodePath struct { From string `json:"from"` To string `json:"to"` PathType string `json:"type"` SelectorCallee string `json:"selector_callee"` ContainerPackage string `json:"container_package"` ContainerPackageCaller string `json:"container_package_caller"` PathAttrs map[string]string `json:"path_attrs"` }
CodePath represents a source code flow.
type CompileEdge ¶
type CompileEdge struct { Caller *ssa.Function Callee *ssa.Function // contains filtered or unexported fields }
CompileEdge for us represents a compile time edge.
func GetCompileTimeCalls ¶
func GetCompileTimeCalls(dir string, args []string, gopath string) ([]CompileEdge, error)
GetCompileTimeCalls returns a golang callgraph that contains all the edges we need to put between our functions that go into the callgraph.
func (*CompileEdge) Description ¶
func (e *CompileEdge) Description() string
Description is a method that returns a description for the edge from the underlying callgraph edge.
func (*CompileEdge) Filename ¶
func (e *CompileEdge) Filename() string
Filename gives the filename in which the call was made.
func (*CompileEdge) Line ¶
func (e *CompileEdge) Line() int
Line gives the Line where the call was made.
type ImportContainer ¶
type ImportContainer struct { LocalName string `json:"local_name"` ImportPath string `json:"import_path"` DependentPkg string `json:"dependent_pkg"` }
ImportContainer is a type to contain the import declaration, similar to *ast.ImportSpec
type MetaRepo ¶
type MetaRepo struct { Branch string `json:"branch"` Revision string `json:"revision"` URL string `json:"url"` LocalPath string `json:"local_path"` }
MetaRepo contains all the fields that are required to clone something.
type ServiceComponents ¶
type ServiceComponents struct { // The name of this service Servicename string `json:"servicename,omitempty"` // AllPkgFunc variable contains all the packages of the service and their corresponding functions. AllPkgFunc map[string][]string `json:"all_pkg_func,omitempty"` // AllPkgImports contains all the external dependencies, again mapped to packages. AllPkgImports map[string]interface{} `json:"all_pkg_imports,omitempty"` // TODO: Add a field for compile time flows for all the services here? // AllDeclaredPackages contains all the packages declared in this service, in a map because there's no set in this language. AllDeclaredPackages map[string]bool `json:"all_declared_packages,omitempty"` // FilePackageMap is a mapping that tell you which package is in which file. // Contains absolute path of file(relative to root of current package package ex. pkg/a/b.go) FilePackageMap map[string]string `json:"file_package_map,omitempty"` }
ServiceComponents is the result of calling ParseService on a repository(folder).
func NewServiceComponents ¶
func NewServiceComponents(servicename string) *ServiceComponents
Creates a new service components structure for serviceparser's use.
func (*ServiceComponents) ParseService ¶
func (components *ServiceComponents) ParseService(serviceName string, root string)
ParseService parses a service and dumps all its functions to a JSON
type SimpleFunctionRepresentation ¶
type SimpleFunctionRepresentation struct { Fun string `json:"fun"` Pkg string `json:"pkg"` DeclFile string `json:"decl_file"` }
A barebones function representation
type TouchPoints ¶
type TouchPoints struct { FunctionsChanged []SimpleFunctionRepresentation `json:"functions_changed"` FunctionsDeleted []SimpleFunctionRepresentation `json:"functions_deleted"` FunctionsAdded []SimpleFunctionRepresentation `json:"functions_added"` }
Struct Touchpoints defines all the touchpoints of a PR
func GetTouchPointsOfPR ¶
func GetTouchPointsOfPR(allDiffs []*gdf.FileDiff, branchDetails []MetaRepo) *TouchPoints
GetTouchPointsOfPR is used to get the functions that are affected by a certain PR. (Go source code changes.)
func (*TouchPoints) Flatten ¶
func (t *TouchPoints) Flatten() []SimpleFunctionRepresentation