errside

command module
v0.0.0-...-9d8618e Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2017 License: MIT Imports: 10 Imported by: 0

README

Errors as Side Notes

If Java-style catch blocks are like footnotes in a book, then Go error-handling statements are like parentheticals. Both are annoying. The first takes you too far away from the main text, while the second is so close to it that it's distracting.

Side notes are a great alternative: the extra material is just an eye-shift away, but you can easily ignore it if you want to.

This package displays Go error-handling on the right side of the screen.

Before:

func (ds *GitDataSource) Fetch(from, to string) ([]string, error) {
	fmt.Printf("Fetching data from %s into %s...\n", from, to)
	if err := createFolderIfNotExist(to); err != nil {
		return nil, err
	}
	if err := clearFolder(to); err != nil {
		return nil, err
	}
	if err := cloneRepo(to, from); err != nil {
		return nil, err
	}
	dirs, err := getContentFolders(to)
	if err != nil {
		return nil, err
	}
	fmt.Println("Fetching complete.")
	return dirs, nil
}

After:

func (ds *GitDataSource) Fetch(from, to string) ([]string, error) {
    fmt.Printf("Fetching data from %s into %s...\n", from, to)
    createFolderIfNotExist(to)                      =: err; if err != nil { return nil, err }
    clearFolder(to)                                 =: err; if err != nil { return nil, err }
    cloneRepo(to, from)                             =: err; if err != nil { return nil, err }
    dirs := getContentFolders(to)                   =: err; if err != nil { return nil, err }
    fmt.Println("Fetching complete.")
    return dirs, nil
}

Note: the following packages were copied from the go/ subtree of the standard library:

  • ast
  • importer
  • internal/*
  • parser
  • printer
  • types

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package ast declares the types used to represent syntax trees for Go packages.
Package ast declares the types used to represent syntax trees for Go packages.
Package importer provides access to export data importers.
Package importer provides access to export data importers.
internal
gccgoimporter
Package gccgoimporter implements Import for gccgo-generated object files.
Package gccgoimporter implements Import for gccgo-generated object files.
gcimporter
Package gcimporter implements Import for gc-generated object files.
Package gcimporter implements Import for gc-generated object files.
Package parser implements a parser for Go source files.
Package parser implements a parser for Go source files.
Package printer implements printing of AST nodes.
Package printer implements printing of AST nodes.
Package types declares the data types and implements the algorithms for type-checking of Go packages.
Package types declares the data types and implements the algorithms for type-checking of Go packages.

Jump to

Keyboard shortcuts

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