replica

command module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 7 Imported by: 0

README

Replica 💎

Replica is a golang code generation tool for mocking interfaces.

Usage

go get

Example

Example File w/ Go Generate Statement
//go:generate replica
package main

import (
	"os"
)

// replica:gen
type (
	Example[T any] interface {
		Method(T) (any, os.File)
	}
)
Automatically Generated Mock
// This is an automatically generated file! Do not modify.
package main
 
import( 
	 "os" 
)

type (
	// MockExample is an automatically generated function mocking the Example interface.
	MockExample[T any,] struct { 
		OnMethod func( 
			t T,
		) ( 
			any,
			os.File,
		) 
	} 
)

// Method is an automatically generated function used for mocking.
func (mock *MockExample[T,]) Method(
	t T,
) (
	any, 
	os.File, 
) {  
	return mock.OnMethod(
		t,
	)
}

Documentation

Overview

This is an automatically generated file! Do not modify.

Directories

Path Synopsis
This is an automatically generated file! Do not modify.
This is an automatically generated file! Do not modify.

Jump to

Keyboard shortcuts

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