Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 938 Bytes

File metadata and controls

34 lines (26 loc) · 938 Bytes

CheckAPI

CheckAPI is a go tool that parses the AST tree of a Go module, identifying Golang APIs such as structs and functions and enforcing rules against them.

This is particularly useful to reduce the API surface of a Go module to a specific set of functions.

Running CheckAPI

$> checkapi -folder . -config config.yaml

Configuration

The configuration file is in yaml format:

ignored_paths:
  - <exact relative paths of Golang modules to ignore>
allowed_functions:
  - <at least one function match must be present.>
  - name: <name of function>
    parameters: <list of parameters by type>
    return_types: <list of return types>

ignored_functions:
  - <regular expressions of ignored functions. At least one match must be present to ignore the function.>
unkeyed_literal_initialization:
  enabled: <bool>
  limit: <number of fields under which we should prevent unkeyed literal initialization>