Giter VIP home page Giter VIP logo

struct2interface's Introduction

struct2interface

struct2interface is a CLI utility to extract an interface from a Golang struct

Installation

go get github.com/reflog/struct2interface

Usage

struct2interface --help

Usage:
  struct2interface [flags]

Flags:
  -f, --folder string      Path to the package in which the struct resides
  -h, --help               help for struct2interface
  -i, --interface string   Name of the output interface
  -o, --output string      Path to output file (will be overwritten)
  -p, --package string     Name of the package in which the struct resides
  -s, --struct string      Name of the input struct
  -t, --template string    Path to a Go template file to use for writing the resulting interface

struct2interface -f "/home/reflog/go/src/github.com/mattermost/mattermost-server/app" -o "/home/reflog/go/src/github.com/mattermost/mattermost-server/
app/app_iface.go" -p "app" -s "App" -i "AppIface"

Other tools

Before writing this, I tried the following projects, but encountered issues:

Interfacer - incredibly slow, dumps odd messages to stderr and writes fully qualified package name instead of localized one, i.e. *github.com/mattermost/mattermost-server/v5/model.Config instead of *model.Config
Ifacemaker - created duplicate imports (in my case "html/template" and "text/template")

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

struct2interface's People

Contributors

reflog avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.