Documentation ¶
Index ¶
- Constants
- func Log(msg ...string)
- func PWD() (string, error)
- func Sources(dir string, recursive bool) ([]string, error)
- func Tests(dir string, recursive bool) ([]string, error)
- type Check
- func Contains(dir, function string, recursive bool) (*Check, error)
- func ContainsPWD(function string, recursive bool) (*Check, error)
- func NewCheck() *Check
- func SourcesContains(dir, function string, recursive bool) (*Check, error)
- func SourcesContainsPWD(function string, recursive bool) (*Check, error)
- func TestsContains(dir, function string, recursive bool) (*Check, error)
- func TestsContainsPWD(function string, recursive bool) (*Check, error)
- type Code
- type CodeFormat
- type ContainsOutput
Constants ¶
const CLIENV = "INHOUSECLI"
CLIENV is a special environment variable only present during CLI run. Used internally to determine the caller is CLI/source/tests.
Variables ¶
This section is empty.
Functions ¶
func Log ¶
func Log(msg ...string)
Log conditionally STDOUTs the given message, depending on DEBUG flag.
Types ¶
type Check ¶
type Check struct { Contained bool `json:"contained"` Matches []*Code `json:"matches"` Misses []*Code `json:"misses"` // Just for testing. Tester interface{} `json:"tester,omitempty"` }
Check represents a checker result.
func Contains ¶
Contains returns true when source files in the caller directory contains the specified Go function. The starting directory is where you call this function. This function will search for source and test files.
func ContainsPWD ¶
ContainsPWD returns true when source files in the caller directory contains the specified Go function. The starting directory is where you call this function. This function will search for source and test files.
func SourcesContains ¶
SourcesContains returns true when source files in the caller directory contains the specified Go function. The starting directory is where you call this function. This function will not check for `*_test.go` files.
func SourcesContainsPWD ¶
SourcesContainsPWD is a wrapper of SourcesContains to resolve directory as `pwd`. Intended to be used inside test codes.
func TestsContains ¶
TestsContains returns true when test files in the caller directory contains the specified Go function. The starting directory is where you call this function. This function will check for `*_test.go` files only.
func TestsContainsPWD ¶
TestsContainsPWD is a wrapper of TestsContains to resolve directory as `pwd`. Intended to be used inside test codes.
type Code ¶
type Code struct { Filepath string `json:"filePath"` Function string `json:"function"` Line int `json:"line"` // Just for testing. Tester interface{} `json:"tester,omitempty"` }
Code represents a Go code with some information for post processing.
func (Code) Format ¶
func (c Code) Format(style CodeFormat) string
Format code to applicable styles. Suitable to be used together with CLI flags.
type CodeFormat ¶
type CodeFormat string
CodeFormat represents print styles.
const ( CSVFormat CodeFormat = "csv" ColonFormat CodeFormat = "colon" JSONFormat CodeFormat = "json" TSVFormat CodeFormat = "tsv" )
List of code formats.
type ContainsOutput ¶
ContainsOutput represents a matching result of code.
func (ContainsOutput) HasCode ¶
func (c ContainsOutput) HasCode() bool
HasCode internally checks code field.