vet can identify which dependencies your code actually uses via static code analysis. When triaging vulnerabilities, this lets you focus on packages that are imported and deprioritize those that are only declared.
This page covers the dependency-usage workflow. For the underlying Code Analysis feature, including supported languages and options, see that page.
Demo
Quick Start
Step 1: Create Code Analysis Database
Build a code analysis database for your source code:src directory, extracts import statements and usage patterns, and stores the results in a SQLite database.
Step 2: Scan with Usage Enrichment
Run a Vet scan enriched with the dependency usage database:- Usage Evidence: which dependencies are actually imported and used
- Used-in-Code Tags: markers on packages confirmed as used in code
- Prioritized Results: packages with real usage are highlighted
Advanced Usage Patterns
Language-Specific Analysis
To target a specific language:Understanding the Results
Usage Evidence Types
The code analysis records several types of evidence:- Import Statements
- Function Calls
- Module References
Tags and Annotations
Dependencies found in your source code are marked with theused-in-code tag, so you can prioritize them over packages that are only declared in a manifest.
Scope Separation
Environment Separation
Environment Separation
Create separate databases for different scopes:
Code Analysis Guide
Learn more about Vet’s code analysis capabilities
Policy as Code
Create policies that leverage usage information
Vet Repository
Access complete documentation and examples
Tree-sitter Parsers
Learn about the parsing technology behind code analysis

