return-structs

command module
v0.0.0-...-5e7d0f5 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2019 License: MIT Imports: 9 Imported by: 0

README

Return Structs Linter

Checks functions return structs, not interfaces.

Why

"Accept Interfaces, Return Structs"

The output of this should be considered a warning or notification, not an error because there are some valid reasons to return an interface.

I hadn't used the Go ast/parser libraries yet, so this was an excuse.

Run

One file:

go build
./return-structs example/main.go
#Returned interface found on line 15: UserInterface

Entire project:

find . -name "*.go" -not -path "./vendor/*" | xargs -n1 return-structs

TODO

  • Support ./... to search entire projects
  • Support multiple files
  • Display a help screen
  • Tests
  • Documentation

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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