Skip to content

Commit

Permalink
fix(lint): ignoring fprintf errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelrubbioli authored and rafaelsq committed Oct 5, 2020
1 parent ca38aa4 commit 003cbde
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/wtc/wtc.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"time"

"github.com/radovskyb/watcher"
yaml "gopkg.in/yaml.v2"
"gopkg.in/yaml.v2"
)

var (
Expand Down Expand Up @@ -106,7 +106,7 @@ func ParseArgs() *Config {
} else if has && flag.NArg() == 1 {
trigs = flag.Arg(0)
} else if !has && flag.NArg() < 2 {
fmt.Fprintf(os.Stderr, "No [.]wtc.yaml or valid command provided.\n")
_, _ = fmt.Fprintf(os.Stderr, "No [.]wtc.yaml or valid command provided.\n")
flag.CommandLine.Usage()
os.Exit(1)
} else if !has {
Expand Down Expand Up @@ -175,7 +175,7 @@ func Start(cfg *Config) {
if r.Rune == BR || (r.Title != current || (currentIsErr == nil || r.IsStderr != *currentIsErr)) {
// close current
if currentOut != nil {
(*currentOut).Write(currentArgs[1])
_, err = (*currentOut).Write(currentArgs[1])
}

// parse tpl
Expand All @@ -192,7 +192,7 @@ func Start(cfg *Config) {

// set current
current = r.Title
currentIsErr = &[]bool{!!r.IsStderr}[0]
currentIsErr = &[]bool{r.IsStderr}[0]
currentArgs = bytes.Split(output, []byte("{{.Message}}"))

if r.IsStderr {
Expand All @@ -202,14 +202,14 @@ func Start(cfg *Config) {
}

// write start
currentOut.Write(currentArgs[0])
_, err = currentOut.Write(currentArgs[0])
}

if r.Rune == 0 || r.Rune == BR {
continue
}

fmt.Fprintf(currentOut, "%c", r.Rune)
_, err = fmt.Fprintf(currentOut, "%c", r.Rune)
}
}()

Expand Down Expand Up @@ -471,7 +471,7 @@ func trig(rule *Rule, pkg, path string) error {
for _, l := range strings.Split(body, "\n") {
l := strings.TrimSpace(l)
if len(l) > 0 && l[0] != '#' {
pieces := strings.Split(string(exportRe.ReplaceAllString(l, "")), "=")
pieces := strings.Split(exportRe.ReplaceAllString(l, ""), "=")
if len(pieces) > 1 {
keys[strings.TrimSpace(pieces[0])] = pieces[1]
}
Expand Down

0 comments on commit 003cbde

Please sign in to comment.