#Analyze Command line utility to analyze go source files using go/ast.
go get github.com/markclow/analyze
analyze --help
Was a package imported in the go file?
Useful to check if the go file imports the correct packages.
analyze isImported --fileName ~/_projects/_work/analyze/testdata/functions_1.go --package fmt
Get a comma-separated list of the parameters passed to the function in the go file.
Useful to check if the function was written as expected (ie expects the correct parameters).
analyze getFunctionParameters --fileName ~/_projects/_work/analyze/testdata/functions_4.go --functionName computeMarsYears
Get a comma-separated list of the results returned by the function in the go file.
Useful to check if the function was written as expected (ie returns the correct results).
analyze getFunctionResults --fileName ~/_projects/_work/analyze/testdata/functions_4.go --functionName computeMarsYears
Get a comma-separated list of the functions that invoke the function in the go file.
Useful to check if the function is called anywhere.
analyze getFunctionInvokedBy --fileName ~/_projects/_work/analyze/testdata/functions_1.go --functionName eatTacos