linting: add to Makefile & do some fixes

This commit is contained in:
Zach Ramsay
2017-09-22 11:42:29 -04:00
parent 2130c329eb
commit d6e03d2368
20 changed files with 82 additions and 51 deletions

View File

@ -8,6 +8,7 @@ import (
"os"
"os/signal"
"strings"
"syscall"
)
var (
@ -17,7 +18,7 @@ var (
func TrapSignal(cb func()) {
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
signal.Notify(c, os.Kill)
signal.Notify(c, syscall.SIGTERM)
go func() {
for sig := range c {
fmt.Printf("captured %v, exiting...\n", sig)
@ -83,12 +84,7 @@ func MustReadFile(filePath string) []byte {
}
func WriteFile(filePath string, contents []byte, mode os.FileMode) error {
err := ioutil.WriteFile(filePath, contents, mode)
if err != nil {
return err
}
// fmt.Printf("File written to %v.\n", filePath)
return nil
return ioutil.WriteFile(filePath, contents, mode)
}
func MustWriteFile(filePath string, contents []byte, mode os.FileMode) {