From ed49d8cc9a43f85f37df16142f5150ec3167eee0 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 16 Oct 2023 00:23:18 +0900 Subject: [PATCH] internal/ui: 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..f379eb42c 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.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 { diff --git a/internal/ui/ui_ios.go b/internal/ui/ui_ios.go index ff751d924..5d6d6f000 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.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() }