Skip to content

Commit 831405b

Browse files
committed
code more robust
1 parent fefcf74 commit 831405b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/msg/msg.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ var (
170170
)
171171

172172
func fmtFMessage(w io.Writer, pc uintptr, fn string, line int, ok bool, err error) {
173-
funcName := runtime.FuncForPC(pc).Name()
174-
fileName := filepath.Base(fn)
175173
if ok {
174+
funcName := runtime.FuncForPC(pc).Name()
175+
fileName := filepath.Base(fn)
176176
fmt.Fprintf(w, formatString+"\n", fileName, line, funcName, err)
177177
} else {
178178
fmt.Fprintln(w, seriousError)
@@ -184,9 +184,9 @@ func fmtMessage(pc uintptr, fn string, line int, ok bool, err error) {
184184
}
185185

186186
func logMessage(pc uintptr, fn string, line int, ok bool, err error) {
187-
funcName := runtime.FuncForPC(pc).Name()
188-
fileName := filepath.Base(fn)
189187
if ok {
188+
funcName := runtime.FuncForPC(pc).Name()
189+
fileName := filepath.Base(fn)
190190
logFatalf(formatString, fileName, line, funcName, err)
191191
} else {
192192
logFatalf("%s", seriousError)

0 commit comments

Comments
 (0)