Skip to content

Commit e0c20e8

Browse files
committed
Formatting uisng gofumpt
1 parent 1d1dad3 commit e0c20e8

File tree

5 files changed

+23
-22
lines changed

5 files changed

+23
-22
lines changed

browser_wasm.go

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,21 @@ func CreateWindow(_, _ int, title string, monitor *Monitor, share *Window) (*Win
106106
}
107107
}
108108

109-
js.Global().Call("addEventListener", "focus", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
109+
js.Global().Call("addEventListener", "focus", js.FuncOf(func(this js.Value, args []js.Value) any {
110110
if w.focusCallback != nil {
111111
w.focusCallback(w, true)
112112
}
113113
return nil
114114
}))
115115

116-
js.Global().Call("addEventListener", "blur", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
116+
js.Global().Call("addEventListener", "blur", js.FuncOf(func(this js.Value, args []js.Value) any {
117117
if w.focusCallback != nil {
118118
w.focusCallback(w, false)
119119
}
120120
return nil
121121
}))
122122

123-
js.Global().Call("addEventListener", "resize", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
123+
js.Global().Call("addEventListener", "resize", js.FuncOf(func(this js.Value, args []js.Value) any {
124124
// HACK: Go fullscreen?
125125
w.devicePixelRatio = js.Global().Get("devicePixelRatio").Float()
126126
widthScaled, heightScaled := w.GetSize()
@@ -139,7 +139,7 @@ func CreateWindow(_, _ int, title string, monitor *Monitor, share *Window) (*Win
139139
return nil
140140
}))
141141

142-
document.Call("addEventListener", "keydown", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
142+
document.Call("addEventListener", "keydown", js.FuncOf(func(this js.Value, args []js.Value) any {
143143
ke := args[0]
144144
w.goFullscreenIfRequested()
145145

@@ -172,7 +172,7 @@ func CreateWindow(_, _ int, title string, monitor *Monitor, share *Window) (*Win
172172
ke.Call("preventDefault")
173173
return nil
174174
}))
175-
document.Call("addEventListener", "keyup", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
175+
document.Call("addEventListener", "keyup", js.FuncOf(func(this js.Value, args []js.Value) any {
176176
ke := args[0]
177177
w.goFullscreenIfRequested()
178178

@@ -194,7 +194,7 @@ func CreateWindow(_, _ int, title string, monitor *Monitor, share *Window) (*Win
194194
ke.Call("preventDefault")
195195
return nil
196196
}))
197-
document.Call("addEventListener", "mousedown", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
197+
document.Call("addEventListener", "mousedown", js.FuncOf(func(this js.Value, args []js.Value) any {
198198
me := args[0]
199199
w.goFullscreenIfRequested()
200200

@@ -211,7 +211,7 @@ func CreateWindow(_, _ int, title string, monitor *Monitor, share *Window) (*Win
211211
me.Call("preventDefault")
212212
return nil
213213
}))
214-
document.Call("addEventListener", "mouseup", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
214+
document.Call("addEventListener", "mouseup", js.FuncOf(func(this js.Value, args []js.Value) any {
215215
me := args[0]
216216
w.goFullscreenIfRequested()
217217

@@ -228,13 +228,13 @@ func CreateWindow(_, _ int, title string, monitor *Monitor, share *Window) (*Win
228228
me.Call("preventDefault")
229229
return nil
230230
}))
231-
document.Call("addEventListener", "contextmenu", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
231+
document.Call("addEventListener", "contextmenu", js.FuncOf(func(this js.Value, args []js.Value) any {
232232
me := args[0]
233233
me.Call("preventDefault")
234234
return nil
235235
}))
236236

237-
document.Call("addEventListener", "mousemove", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
237+
document.Call("addEventListener", "mousemove", js.FuncOf(func(this js.Value, args []js.Value) any {
238238
me := args[0]
239239
var movementX, movementY float64
240240
if !w.missing.pointerLock {
@@ -257,7 +257,7 @@ func CreateWindow(_, _ int, title string, monitor *Monitor, share *Window) (*Win
257257
me.Call("preventDefault")
258258
return nil
259259
}))
260-
document.Call("addEventListener", "wheel", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
260+
document.Call("addEventListener", "wheel", js.FuncOf(func(this js.Value, args []js.Value) any {
261261
we := args[0]
262262

263263
deltaX := we.Get("deltaX").Float()
@@ -314,7 +314,7 @@ func CreateWindow(_, _ int, title string, monitor *Monitor, share *Window) (*Win
314314
document.AddEventListener("touchmove", false, touchHandler)
315315
document.AddEventListener("touchend", false, touchHandler)*/
316316

317-
document.Call("addEventListener", "beforeUnload", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
317+
document.Call("addEventListener", "beforeUnload", js.FuncOf(func(this js.Value, args []js.Value) any {
318318
if w.closeCallback != nil {
319319
w.closeCallback(w)
320320
}
@@ -378,7 +378,7 @@ func (w *Window) SetSize(width, height int) {
378378
fmt.Println("not implemented: SetSize:", width, height)
379379
}
380380

381-
func (w *Window) SetIcon(images interface{}) {
381+
func (w *Window) SetIcon(images any) {
382382
// images is actually of type []image.Image, but no need to import image until we actually do something with it
383383
fmt.Println("not implemented: SetIcon")
384384
}
@@ -534,7 +534,7 @@ func (w *Window) SwapBuffers() error {
534534

535535
var animationFrameChan = make(chan struct{}, 1)
536536

537-
var animationFrameCallback = js.FuncOf(func(this js.Value, args []js.Value) interface{} {
537+
var animationFrameCallback = js.FuncOf(func(this js.Value, args []js.Value) any {
538538
animationFrameChan <- struct{}{}
539539

540540
return nil
@@ -592,8 +592,10 @@ func (w *Window) GetInputMode(mode InputMode) int {
592592
}
593593
}
594594

595-
var ErrInvalidParameter = errors.New("invalid parameter")
596-
var ErrInvalidValue = errors.New("invalid value")
595+
var (
596+
ErrInvalidParameter = errors.New("invalid parameter")
597+
ErrInvalidValue = errors.New("invalid value")
598+
)
597599

598600
func (w *Window) SetInputMode(mode InputMode, value int) {
599601
switch mode {
@@ -966,6 +968,7 @@ func DefaultWindowHints() {
966968
func (w *Window) SetClipboardString(str string) {
967969
SetClipboardString(str)
968970
}
971+
969972
func (w *Window) GetClipboardString() string {
970973
return GetClipboardString()
971974
}

clipboard_wasm.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func GetClipboardString() string {
1313
text := make(chan string)
1414

1515
clipboard := js.Global().Get("navigator").Get("clipboard")
16-
clipboard.Call("readText").Call("then", js.FuncOf(func(this js.Value, p []js.Value) interface{} {
16+
clipboard.Call("readText").Call("then", js.FuncOf(func(this js.Value, p []js.Value) any {
1717
content := p[0]
1818
if !content.Truthy() {
1919
text <- ""
@@ -22,7 +22,7 @@ func GetClipboardString() string {
2222

2323
text <- content.String()
2424
return nil
25-
})).Call("catch", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
25+
})).Call("catch", js.FuncOf(func(this js.Value, args []js.Value) any {
2626
text <- ""
2727
return nil
2828
}))

context_webgl_wasm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func newContext(canvas js.Value, ca *contextAttributes) (context js.Value, err e
1212
return js.Value{}, errors.New("Your browser doesn't appear to support WebGL.")
1313
}
1414

15-
attrs := map[string]interface{}{
15+
attrs := map[string]any{
1616
"alpha": ca.Alpha,
1717
"depth": ca.Depth,
1818
"stencil": ca.Stencil,

glfw.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ package glfw
1010
type ContextWatcher interface {
1111
// OnMakeCurrent is called after a context is made current.
1212
// context is is a platform-specific representation of the context, or nil if unavailable.
13-
OnMakeCurrent(context interface{})
13+
OnMakeCurrent(context any)
1414

1515
// OnDetach is called after the current context is detached.
1616
OnDetach()

hint_glfw.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ const (
4242
FailIfMajorPerformanceCaveat
4343
)
4444

45-
const (
46-
NoAPI int = glfw.NoAPI
47-
)
45+
const NoAPI int = glfw.NoAPI
4846

4947
// noopHint is ignored.
5048
const noopHint Hint = -1

0 commit comments

Comments
 (0)