Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CLI Tool to extract an Interface from a Golang struct using AST

License

NotificationsYou must be signed in to change notification settings

reflog/struct2interface

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Installation

go get github.com/reflog/struct2interface

Usage

struct2interface --helpUsage:  struct2interface [flags]Flags:  -f, --folder string      Path to the packagein which the struct resides  -h, --helphelpfor 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 packagein which the struct resides  -s, --struct string      Name of the input struct  -t, --template string    Path to a Go template file to usefor writing the resulting interfacestruct2interface -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

About

CLI Tool to extract an Interface from a Golang struct using AST

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp