Contributing

Contributions are welcome! This guide will help you set up your development environment to build and test pdtm.

Prerequisites

  • Go: Version 1.24.3 or later.
  • Make: For running build scripts.

Building from Source

Clone the repository and run the build command using the provided Makefile.

git clone https://github.com/projectdiscovery/pdtm.git
cd pdtm
make build

This will compile the project and create a pdtm binary in the root directory.

Running Tests

To run the unit tests:

make test

Code Linting

The project uses golangci-lint for code quality.

golangci-lint run

Project Structure

  • cmd/pdtm: Contains the main entry point (pdtm.go).
  • internal/runner: Core logic for the CLI, including flag parsing and the main run loop.
  • pkg/install.go: Logic for downloading binaries or using go install.
  • pkg/update.go: Logic for updating tools.
  • pkg/path: OS-specific logic for managing the $PATH environment variable (Unix/Windows).
  • pkg/types: Data structures for tools and requirements.
  • pkg/utils: Helper functions for API interaction and version checking.