impl.git

command module
v0.0.0-...-8a48733 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2019 License: MIT Imports: 17 Imported by: 0

README

impl generates method stubs for implementing an interface.

go get -u github.com/josharian/impl

Sample usage:

$ impl -iface io.ReadWriteCloser -struct file/file.go
func (f *File) Read(p []byte) (n int, err error) {
	panic("not implemented")
}

func (f *File) Write(p []byte) (n int, err error) {
	panic("not implemented")
}

func (f *File) Close() error {
	panic("not implemented")
}

# You can also provide a full name by specifying the package path.
# This helps in cases where the interface can't be guessed
# just from the package name and interface name.
$ impl -iface golang.org/x/oauth2.TokenSource -struct file/source.go
func (s *Source) Token() (*oauth2.Token, error) {
    panic("not implemented")
}

TODO

  • Add the first part of the file.
  • Add features that match a specific structure.

Documentation

Overview

impl generates method stubs for implementing an interface. Update: Read the file, get the structures, implement the interface from the structure

Jump to

Keyboard shortcuts

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