dropin-gen

command module
v0.0.0-...-206a3d8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

README

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.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL