From bdd68ca01ae8a8435adf69a392dc50f980e3a5d2 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 16 Oct 2023 00:23:18 +0900 Subject: [PATCH] internal/ui: reland: use errors.New instead of fmt.Errorf --- internal/ui/ui_android.go | 5 +++-- internal/ui/ui_ios.go | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/ui/ui_android.go b/internal/ui/ui_android.go index 9f5fba691..2a69cd889 100644 --- a/internal/ui/ui_android.go +++ b/internal/ui/ui_android.go @@ -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.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") } func deviceScaleFactorImpl() float64 { diff --git a/internal/ui/ui_ios.go b/internal/ui/ui_ios.go index ff751d924..9726f18a3 100644 --- a/internal/ui/ui_ios.go +++ b/internal/ui/ui_ios.go @@ -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.New("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.New("ui: Metal is not available with gomobile-build") } return metal.NewGraphics() }