internal/ui: use errors.New instead of fmt.Errorf

This commit is contained in:
Hajime Hoshi 2023-10-15 23:27:04 +09:00
parent 742f3a6dac
commit 47e70f2544
5 changed files with 13 additions and 11 deletions

View File

@ -17,6 +17,7 @@
package ui
import (
"errors"
"fmt"
"reflect"
"unsafe"
@ -185,7 +186,7 @@ func (*graphicsDriverCreatorImpl) newOpenGL() (graphicsdriver.Graphics, error) {
}
func (*graphicsDriverCreatorImpl) newDirectX() (graphicsdriver.Graphics, error) {
return nil, fmt.Errorf("ui: DirectX is not supported in this environment")
return nil, errors.New("ui: DirectX is not supported in this environment")
}
func (*graphicsDriverCreatorImpl) newMetal() (graphicsdriver.Graphics, error) {

View File

@ -15,7 +15,7 @@
package ui
import (
"fmt"
"errors"
"image"
"math"
"sync"
@ -43,11 +43,11 @@ func (g *graphicsDriverCreatorImpl) newOpenGL() (graphicsdriver.Graphics, error)
}
func (*graphicsDriverCreatorImpl) newDirectX() (graphicsdriver.Graphics, error) {
return nil, fmt.Errorf("ui: DirectX is not supported in this environment")
return nil, errors.New("ui: DirectX is not supported in this environment")
}
func (*graphicsDriverCreatorImpl) newMetal() (graphicsdriver.Graphics, error) {
return nil, fmt.Errorf("ui: Metal is not supported in this environment")
return nil, errors.New("ui: Metal is not supported in this environment")
}
var (

View File

@ -17,6 +17,7 @@
package ui
import (
"errors"
"fmt"
"runtime"
@ -47,11 +48,11 @@ func (*graphicsDriverCreatorImpl) newOpenGL() (graphicsdriver.Graphics, error) {
}
func (*graphicsDriverCreatorImpl) newDirectX() (graphicsdriver.Graphics, error) {
return nil, fmt.Errorf("ui: DirectX is not supported in this environment")
return nil, errors.New("ui: DirectX is not supported in this environment")
}
func (*graphicsDriverCreatorImpl) newMetal() (graphicsdriver.Graphics, error) {
return nil, fmt.Errorf("ui: Metal is not supported in this environment")
return nil, errors.New("ui: Metal is not supported in this environment")
}
// glfwMonitorSizeInGLFWPixels must be called from the main thread.

View File

@ -22,7 +22,7 @@ import "C"
import (
stdcontext "context"
"fmt"
"errors"
"image"
"runtime"
"sync"
@ -47,11 +47,11 @@ func (*graphicsDriverCreatorImpl) newOpenGL() (graphicsdriver.Graphics, error) {
}
func (*graphicsDriverCreatorImpl) newDirectX() (graphicsdriver.Graphics, error) {
return nil, fmt.Errorf("ui: DirectX is not supported in this environment")
return nil, errors.New("ui: DirectX is not supported in this environment")
}
func (*graphicsDriverCreatorImpl) newMetal() (graphicsdriver.Graphics, error) {
return nil, fmt.Errorf("ui: Metal is not supported in this environment")
return nil, errors.New("ui: Metal is not supported in this environment")
}
const deviceScaleFactor = 1

View File

@ -80,13 +80,13 @@ func (*graphicsDriverCreatorImpl) newOpenGL() (graphicsdriver.Graphics, error) {
func (g *graphicsDriverCreatorImpl) newDirectX() (graphicsdriver.Graphics, error) {
if g.transparent {
return nil, fmt.Errorf("ui: DirectX is not available with a transparent window")
return nil, errors.New("ui: DirectX is not available with a transparent window")
}
return directx.NewGraphics()
}
func (*graphicsDriverCreatorImpl) newMetal() (graphicsdriver.Graphics, error) {
return nil, fmt.Errorf("ui: Metal is not supported in this environment")
return nil, errors.New("ui: Metal is not supported in this environment")
}
// glfwMonitorSizeInGLFWPixels must be called from the main thread.