counter

package
v0.0.0-...-1ee0d49 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Min

func Min(x, y int) int

*

  • returns the smaller of two integers. Needed because Go only natively offers a minimum function for floating
  • point values

func Run

func Run(config Config, paths ...string)

*

  • Run is the main entry point for the go-geiger logic

Types

type Config

type Config struct {
	MaxDepth            int  // maximum depth in the import tree
	ShortenSeenPackages bool // if true, packages that are duplicated will only print their subtree once
	PrintLinkToPkgGoDev bool // if true, print a link to pkg.go.dev instead of the package name

	DetailedStats    bool // if true, output separate numbers for different usage contexts
	HideStats        bool // if true, do not output the table with usage counts but only print code
	PrintUnsafeLines bool // if true, print code lines where unsafe usages are found

	ShowStandardPackages bool   // if true, also show packages from the Go standard library which are omitted otherwise
	MatchFilter          string // filter unsafe matches to all,pointer,sizeof,alignof,offsetof,sliceheader,stringheader, or uintptr
	ContextFilter        string // filter context matches to all,variable,parameter,assignment,call,other

	Output io.Writer // output stream, needed to redirect output in testing
}

*

  • The Config structure represents the command line arguments passed to go-geiger

type IndentType

type IndentType int

this enum represents different possible indents used to build an ASCII tree shape

const (
	Space IndentType = iota
	I
	T
	L
)

type LocalPackageCounts

type LocalPackageCounts struct {
	Local      int
	Variable   int
	Parameter  int
	Assignment int
	Call       int
	Other      int
}

*

  • LocalPackageCounts represents the number of unsafe usage sites in a given package, grouped by the context in which
  • they were found. The Local field represents the total number in the package, but it is not named Total in order to
  • disambiguate from the total number of unsafe usages in the package and its dependencies together.

type Stats

type Stats struct {
	ImportCount             int
	UnsafeCount             int
	TransitivelyUnsafeCount int
	SafeCount               int
}

*

  • Stats represents the number of packages in the dependency tree of a given package, grouped by categories for directly
  • unsafe, transitively importing unsafe, and not using unsafe, as well as total

Jump to

Keyboard shortcuts

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