gvisor.dev/gvisor@v0.0.0-20240520182842-f9d4d51c7e0f/tools/nogo/README.md (about)

     1  # Extended "nogo" analysis
     2  
     3  This package provides a build aspect that perform nogo analysis. This will be
     4  automatically injected to all relevant libraries when using the default
     5  `go_binary` and `go_library` rules.
     6  
     7  It exists for several reasons.
     8  
     9  *   The default `nogo` provided by bazel is insufficient with respect to the
    10      possibility of binary analysis. This package allows us to analyze the
    11      generated binary in addition to using the standard analyzers.
    12  
    13  *   The configuration provided in this package is much richer than the standard
    14      `nogo` JSON blob. Specifically, it allows us to exclude specific structures
    15      from the composite rules (such as the Ranges that are common with the set
    16      types).
    17  
    18  *   The bazel version of `nogo` is run directly against the `go_library` and
    19      `go_binary` targets, meaning that any change to the configuration requires a
    20      rebuild from scratch (for some reason included all C++ source files in the
    21      process). Using an aspect is more efficient in this regard.
    22  
    23  *   The checks supported by this package are exported as tests, which makes it
    24      easier to reason about and plumb into the build system.
    25  
    26  *   For uninteresting reasons, it is impossible to integrate the default `nogo`
    27      analyzer provided by bazel with internal Google tooling. To provide a
    28      consistent experience, this package allows those systems to be unified.
    29  
    30  To use this package, import `nogo_test` from `defs.bzl` and add a single
    31  dependency which is a `go_binary` or `go_library` rule.