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

This commit is contained in:
Hajime Hoshi 2023-10-16 00:23:18 +09:00
parent e1f18b53f5
commit ed49d8cc9a
2 changed files with 6 additions and 4 deletions

View File

@ -85,6 +85,7 @@ static float deviceScale(uintptr_t java_vm, uintptr_t jni_env, uintptr_t ctx) {
import "C"
import (
"errors"
"fmt"
"golang.org/x/mobile/app"
@ -108,11 +109,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.Errorf("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.Errorf("ui: Metal is not supported in this environment")
}
func deviceScaleFactorImpl() float64 {

View File

@ -25,6 +25,7 @@ package ui
import "C"
import (
"errors"
"fmt"
"golang.org/x/mobile/gl"
@ -55,12 +56,12 @@ 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.Errorf("ui: DirectX is not supported in this environment")
}
func (g *graphicsDriverCreatorImpl) newMetal() (graphicsdriver.Graphics, error) {
if g.gomobileContext != nil {
return nil, fmt.Errorf("ui: Metal is not available with gomobile-build")
return nil, errors.Errorf("ui: Metal is not available with gomobile-build")
}
return metal.NewGraphics()
}