Skip to content

Commit 5fb9613

Browse files
Armin BecherArmin Becher
Armin Becher
authored and
Armin Becher
committed
style: fix linter warnings
1 parent 55a4eb1 commit 5fb9613

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

internal/model/model.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func ParseStackPos(text string) (fileName string, line int32, pos *int, err erro
5050
text = strings.TrimSpace(text)
5151

5252
if len(text) == 0 {
53-
err = fmt.Errorf("Unexpected empty line")
53+
err = fmt.Errorf("unexpected empty line")
5454
return
5555
}
5656

@@ -66,7 +66,7 @@ func ParseStackPos(text string) (fileName string, line int32, pos *int, err erro
6666
} else {
6767
posInt64, errParse := strconv.ParseInt(text[linePosSep+4:], 16, 64)
6868
if errParse != nil {
69-
err = fmt.Errorf("Could parse stack pos %s to line int. Error: %s", text, errParse.Error())
69+
err = fmt.Errorf("could parse stack pos %s to line int. Error: %s", text, errParse.Error())
7070
return
7171
}
7272
posInt := int(posInt64)
@@ -76,7 +76,7 @@ func ParseStackPos(text string) (fileName string, line int32, pos *int, err erro
7676

7777
lineInt, errParse := strconv.ParseInt(lineStr, 10, 32)
7878
if errParse != nil {
79-
err = fmt.Errorf("Could parse line %s to line int. Err: %s", text, errParse.Error())
79+
err = fmt.Errorf("could parse line %s to line int. Err: %s", text, errParse.Error())
8080
return
8181
}
8282
line = int32(lineInt)
@@ -87,18 +87,18 @@ func ParseStackPos(text string) (fileName string, line int32, pos *int, err erro
8787
// ParseHeader of stack trace. See: https://golang.org/src/runtime/traceback.go?s=30186:30213#L869
8888
func ParseHeader(header string) (routine Goroutine, err error) {
8989
if len(header) < 10 {
90-
err = fmt.Errorf("Expected header to begin with \"goroutine \" but len was < 10")
90+
err = fmt.Errorf("expected header to begin with \"goroutine \" but len was < 10")
9191
return
9292
}
9393
if header[0:10] != "goroutine " {
94-
err = fmt.Errorf("Expected goroutine header, but got: %s", header[0:10])
94+
err = fmt.Errorf("expected goroutine header, but got: %s", header[0:10])
9595
return
9696
}
9797
seperator := strings.Index(header[10:], " ")
9898

9999
id, parseErr := strconv.ParseInt(header[10:10+seperator], 10, 64)
100100
if parseErr != nil {
101-
err = fmt.Errorf("Could not parse ID. Err: %s", parseErr.Error())
101+
err = fmt.Errorf("could not parse ID. Err: %s", parseErr.Error())
102102
return
103103
}
104104

@@ -120,7 +120,7 @@ func ParseHeader(header string) (routine Goroutine, err error) {
120120
minUnitSep := strings.Index(part, " ")
121121
waitTimeMin, parseErr = strconv.ParseInt(part[:minUnitSep], 10, 64)
122122
if parseErr != nil {
123-
err = fmt.Errorf("Failed to parse minutes. Err: %s", parseErr.Error())
123+
err = fmt.Errorf("failed to parse minutes. Err: %s", parseErr.Error())
124124
return
125125
}
126126
}
@@ -165,7 +165,7 @@ func ParseStackFrame(reader io.Reader) (routines []Goroutine, err error) {
165165

166166
if strings.HasPrefix(traceLine, "created by ") {
167167
if !scanner.Scan() {
168-
err = fmt.Errorf("Unexpected end of file")
168+
log.Println("Unexpected end of file")
169169
continue
170170
}
171171

@@ -182,7 +182,7 @@ func ParseStackFrame(reader io.Reader) (routines []Goroutine, err error) {
182182
}
183183
} else {
184184
if !scanner.Scan() {
185-
err = fmt.Errorf("Unexpected end of file")
185+
log.Println("Unexpected end of file")
186186
continue
187187
}
188188
file, line, pos, err := ParseStackPos(scanner.Text())

main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package main
33
import (
44
"flag"
55
"fmt"
6-
"io/ioutil"
6+
"io"
77
"log"
88
"os"
99
"runtime/debug"
@@ -42,7 +42,7 @@ func main() {
4242
defer f.Close()
4343
log.SetOutput(f)
4444
} else {
45-
log.SetOutput(ioutil.Discard)
45+
log.SetOutput(io.Discard)
4646
}
4747

4848
log.Printf("Start roumon (%s)", version)
@@ -61,7 +61,7 @@ func main() {
6161

6262
if err != nil {
6363
fmt.Println(err.Error())
64-
log.Printf(err.Error())
64+
log.Print(err.Error())
6565
}
6666

6767
log.Print("Stopped")

0 commit comments

Comments
 (0)