internal/cglfw: use stderr instead of log

This commit is contained in:
Hajime Hoshi 2023-10-07 18:36:20 +09:00
parent aef7b0dd38
commit cb023af4b6

View File

@ -18,7 +18,7 @@ import "C"
import ( import (
"fmt" "fmt"
"log" "os"
) )
// ErrorCode corresponds to an error code. // ErrorCode corresponds to an error code.
@ -178,13 +178,13 @@ func acceptError(codes ...ErrorCode) error {
// package. // package.
switch err.Code { switch err.Code {
case platformError: case platformError:
log.Println(err) fmt.Fprintln(os.Stderr, err)
return nil return nil
case notInitialized, noCurrentContext, invalidEnum, invalidValue, outOfMemory: case notInitialized, noCurrentContext, invalidEnum, invalidValue, outOfMemory:
panic(err) panic(err)
default: default:
fmt.Println("GLFW: An invalid error was not accepted by the caller:", err) fmt.Fprintln(os.Stderr, "GLFW: An invalid error was not accepted by the caller:", err)
fmt.Println("GLFW: Please report this bug in the Go package immediately.") fmt.Fprintln(os.Stderr, "GLFW: Please report this bug in the Go package immediately.")
panic(err) panic(err)
} }
} }