Created
December 2, 2015 16:18
-
-
Save gerred/3c57d8ce5629a32e3693 to your computer and use it in GitHub Desktop.
state removal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.After = func(c *cli.Context) error { | |
select { | |
case <-log.ErrChan: | |
return errors.New("Exiting with errors") | |
default: | |
return nil | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ErrChan = make(chan bool, 1) | |
func Err(format string, v ...interface{}) { | |
fmt.Fprint(Stderr, pretty.Colorize("{{.Red}}[ERROR]{{.Default}} ")) | |
fmt.Fprintf(Stderr, appendNewLine(format), v...) | |
select { | |
case ErrChan <- true: | |
default: | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment