GitXplorerGitXplorer
s

goreturns

public
531 stars
55 forks
27 issues

Commits

List of commits on branch master.
Unverified
16fc3d8edd918a749329a5a601bddf016be250e0

Make this a Go module

bbsiegert committed 4 years ago
Unverified
538ac601451833c7c4449f8431d65d53c1c60e41

Use pkgDir variable

kkrhubert committed 6 years ago
Unverified
b56a713abde9a93e6cbf032f17d48f10bcbc8dd7

Check PrintErrors cond

kkrhubert committed 6 years ago
Unverified
83e02874ec120f73d5f7dd382d62449dc8abe9c6

fix travis go version

ssqs committed 7 years ago
Unverified
881f519cfc3e93b2ef78fd75a8254c78889bc8c4

enable Travis CI

ssqs committed 7 years ago
Unverified
4028ad9c879e46f6d45c870d119563385646f112

fix typo

ssqs committed 7 years ago

README

The README file for this repository.

This tool adds zero-value return values to incomplete Go return statements, to save you time when writing Go. It is inspired by and based on goimports.

short screencast

full 30-second screencast: http://youtu.be/hyEMO9vtKZ8

For example, the following incomplete return statement:

func F() (*MyType, int, error) { return errors.New("foo") }

is made complete by adding nil and 0 returns (the zero values for *MyType and int):

func F() (*MyType, int, error) { return nil, 0, errors.New("foo") }

To install:

go get -u github.com/sqs/goreturns

To run:

goreturns file.go

To view a diff showing what it'd do on a sample file:

goreturns -d $GOPATH/github.com/sqs/goreturns/_sample/a.go

Editor integration: replace gofmt or goimports in your post-save hook with goreturns. By default goreturns calls goimports on files before performing its own processing.

It acts the same as gofmt (same flags, etc) but in addition to code formatting, also fixes returns.