Socket
Book a DemoInstallSign in
Socket

spheric.cloud/dropin-gen

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spheric.cloud/dropin-gen

Go Modules
Version
v0.0.0-20250715215826-206a3d8a8e2a
Version published
Created
Source

dropin-gen

Go Test Go Reference Go Report Card GitHub License

dropin-gen is a command-line tool for Go that generates a "drop-in" replacement for a given package. It creates a new package that mirrors the public API of an existing package, with all functions and methods delegating to the original. This is useful for creating compatibility layers, mocks, or fakes for testing purposes.

Installation

You can install dropin-gen using go install:

go install spheric.cloud/dropin-gen@latest

Usage

You can invoke dropin-gen with the following flags:

  • -i, --import-path: (Required) The import path of the package to generate a drop-in for.
  • -o, --output-package: (Required) The path to the output package where the generated code will be written.
  • -f, --output-filename: (Optional) The name of the generated Go file. Defaults to zz_generated.dropin.go.
  • --src-dir: (Optional) The source directory to run the tool in. Defaults to the current directory.
  • --go-header-file: (Optional) Go header file to include in the generated code.

Example

Suppose you want to create a drop-in replacement for the fmt package and place it in a local package called myfmt. You would run the following command:

dropin-gen -i fmt -o ./myfmt

This will create a new file myfmt/zz_generated.dropin.go containing the generated drop-in code for the fmt package. The new package will have the name myfmt.

FAQs

Package last updated on 15 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts