all: go fmt ./...

Make all our package sources use Go 1.17 gofmt format
(adding //go:build lines).

Not strictly necessary but will avoid spurious changes
as files are edited.

Part of //go:build change (#41184).
See https://golang.org/design/draft-gobuild

Change-Id: I30822eb504168b037ed3ec0f7759da1f41251f52
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/294374
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
diff --git a/app/android.go b/app/android.go
index 491af51..123502e 100644
--- a/app/android.go
+++ b/app/android.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build android
 // +build android
 
 /*
diff --git a/app/app.go b/app/app.go
index e228b13..19efb07 100644
--- a/app/app.go
+++ b/app/app.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build linux || darwin || windows
 // +build linux darwin windows
 
 package app
diff --git a/app/darwin_desktop.go b/app/darwin_desktop.go
index 5a0302f..d50cdd1 100644
--- a/app/darwin_desktop.go
+++ b/app/darwin_desktop.go
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build darwin
-// +build !ios
+//go:build darwin && !ios
+// +build darwin,!ios
 
 package app
 
diff --git a/app/darwin_ios.go b/app/darwin_ios.go
index f21816c..67afe43 100644
--- a/app/darwin_ios.go
+++ b/app/darwin_ios.go
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build darwin
-// +build ios
+//go:build darwin && ios
+// +build darwin,ios
 
 package app
 
diff --git a/app/internal/testapp/testapp.go b/app/internal/testapp/testapp.go
index 240428a..eb85095 100644
--- a/app/internal/testapp/testapp.go
+++ b/app/internal/testapp/testapp.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build darwin || linux
 // +build darwin linux
 
 // Small test app used by app/app_test.go.
diff --git a/app/shiny.go b/app/shiny.go
index 3257dfa..cffb84b 100644
--- a/app/shiny.go
+++ b/app/shiny.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build windows
 // +build windows
 
 package app
diff --git a/app/x11.go b/app/x11.go
index d6fe7b2..49d1dea 100644
--- a/app/x11.go
+++ b/app/x11.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build linux && !android
 // +build linux,!android
 
 package app
diff --git a/asset/asset.go b/asset/asset.go
index e81b7f3..5ed3a5c 100644
--- a/asset/asset.go
+++ b/asset/asset.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build darwin || linux || windows
 // +build darwin linux windows
 
 package asset
diff --git a/asset/asset_darwin_armx.go b/asset/asset_darwin_armx.go
index 6c9eaec..3eac25b 100644
--- a/asset/asset_darwin_armx.go
+++ b/asset/asset_darwin_armx.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build darwin && (arm || arm64)
 // +build darwin
 // +build arm arm64
 
diff --git a/asset/asset_desktop.go b/asset/asset_desktop.go
index 21a1d71..a360995 100644
--- a/asset/asset_desktop.go
+++ b/asset/asset_desktop.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build (linux && !android) || (darwin && !arm && !arm64) || windows
 // +build linux,!android darwin,!arm,!arm64 windows
 
 package asset
diff --git a/cmd/gomobile/gendex.go b/cmd/gomobile/gendex.go
index d8b58cb..be7470c 100644
--- a/cmd/gomobile/gendex.go
+++ b/cmd/gomobile/gendex.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build ignore
 // +build ignore
 
 // Gendex generates a dex file used by Go apps created with gomobile.
diff --git a/example/basic/main.go b/example/basic/main.go
index b25f81e..110d052 100644
--- a/example/basic/main.go
+++ b/example/basic/main.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build darwin || linux || windows
 // +build darwin linux windows
 
 // An app that draws a green triangle on a red background.
diff --git a/example/basic/main_x.go b/example/basic/main_x.go
index 6b8c13f..52e8c53 100644
--- a/example/basic/main_x.go
+++ b/example/basic/main_x.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build !darwin && !linux && !windows
 // +build !darwin,!linux,!windows
 
 package main
diff --git a/example/flappy/game.go b/example/flappy/game.go
index def8ce1..40921ab 100644
--- a/example/flappy/game.go
+++ b/example/flappy/game.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build darwin || linux
 // +build darwin linux
 
 package main
diff --git a/example/flappy/main.go b/example/flappy/main.go
index 2274993..6f298ea 100644
--- a/example/flappy/main.go
+++ b/example/flappy/main.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build darwin || linux
 // +build darwin linux
 
 // Flappy Gopher is a simple one-button game that uses the
diff --git a/example/flappy/main_x.go b/example/flappy/main_x.go
index 3d440e7..6739924 100644
--- a/example/flappy/main_x.go
+++ b/example/flappy/main_x.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build !darwin && !linux
 // +build !darwin,!linux
 
 package main
diff --git a/example/network/main.go b/example/network/main.go
index c1d26dc..111282e 100644
--- a/example/network/main.go
+++ b/example/network/main.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build darwin || linux || windows
 // +build darwin linux windows
 
 // An app that paints green if golang.org is reachable when the app first
diff --git a/example/network/main_x.go b/example/network/main_x.go
index 2558269..9bda7ac 100644
--- a/example/network/main_x.go
+++ b/example/network/main_x.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build !darwin && !linux && !windows
 // +build !darwin,!linux,!windows
 
 package main
diff --git a/exp/app/debug/fps.go b/exp/app/debug/fps.go
index ef64966..bef808d 100644
--- a/exp/app/debug/fps.go
+++ b/exp/app/debug/fps.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build darwin || linux || windows
 // +build darwin linux windows
 
 // Package debug provides GL-based debugging tools for apps.
diff --git a/exp/audio/al/al.go b/exp/audio/al/al.go
index 0263037..bcddeef 100644
--- a/exp/audio/al/al.go
+++ b/exp/audio/al/al.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build darwin || linux || windows
 // +build darwin linux windows
 
 // Package al provides OpenAL Soft bindings for Go.
diff --git a/exp/audio/al/al_notandroid.go b/exp/audio/al/al_notandroid.go
index 85d3782..577fee3 100644
--- a/exp/audio/al/al_notandroid.go
+++ b/exp/audio/al/al_notandroid.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build darwin || (linux && !android) || windows
 // +build darwin linux,!android windows
 
 package al
diff --git a/exp/audio/al/alc.go b/exp/audio/al/alc.go
index e70594c..f0b4215 100644
--- a/exp/audio/al/alc.go
+++ b/exp/audio/al/alc.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build darwin || linux || windows
 // +build darwin linux windows
 
 package al
diff --git a/exp/audio/al/alc_notandroid.go b/exp/audio/al/alc_notandroid.go
index cb3d8ee..68e907c 100644
--- a/exp/audio/al/alc_notandroid.go
+++ b/exp/audio/al/alc_notandroid.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build darwin || (linux && !android) || windows
 // +build darwin linux,!android windows
 
 package al
diff --git a/exp/audio/al/const.go b/exp/audio/al/const.go
index c8a1cdc..aef0543 100644
--- a/exp/audio/al/const.go
+++ b/exp/audio/al/const.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build darwin || linux || windows
 // +build darwin linux windows
 
 package al
diff --git a/exp/f32/gen.go b/exp/f32/gen.go
index a8438bb..fdd1c3f 100644
--- a/exp/f32/gen.go
+++ b/exp/f32/gen.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build ignore
 // +build ignore
 
 package main
diff --git a/exp/font/font.go b/exp/font/font.go
index 38f6ba6..c145134 100644
--- a/exp/font/font.go
+++ b/exp/font/font.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build linux || darwin
 // +build linux darwin
 
 package font
diff --git a/exp/font/font_linux.go b/exp/font/font_linux.go
index d91fe95..6531623 100644
--- a/exp/font/font_linux.go
+++ b/exp/font/font_linux.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build !android
 // +build !android
 
 package font
diff --git a/exp/font/font_test.go b/exp/font/font_test.go
index 296f7e3..c93c282 100644
--- a/exp/font/font_test.go
+++ b/exp/font/font_test.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build linux || darwin
 // +build linux darwin
 
 package font
diff --git a/exp/gl/glutil/context_darwin_desktop.go b/exp/gl/glutil/context_darwin_desktop.go
index 42488a2..344c73e 100644
--- a/exp/gl/glutil/context_darwin_desktop.go
+++ b/exp/gl/glutil/context_darwin_desktop.go
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build darwin
-// +build !ios
+//go:build darwin && !ios
+// +build darwin,!ios
 
 package glutil
 
diff --git a/exp/gl/glutil/context_x11.go b/exp/gl/glutil/context_x11.go
index 49bda4b..394f1b1 100644
--- a/exp/gl/glutil/context_x11.go
+++ b/exp/gl/glutil/context_x11.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build linux && !android
 // +build linux,!android
 
 package glutil
diff --git a/exp/gl/glutil/glimage.go b/exp/gl/glutil/glimage.go
index c5542fa..ffe953d 100644
--- a/exp/gl/glutil/glimage.go
+++ b/exp/gl/glutil/glimage.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build linux || darwin || windows
 // +build linux darwin windows
 
 package glutil
diff --git a/exp/gl/glutil/glimage_test.go b/exp/gl/glutil/glimage_test.go
index 1cb69db..975e305 100644
--- a/exp/gl/glutil/glimage_test.go
+++ b/exp/gl/glutil/glimage_test.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build darwin || (linux && !android)
 // +build darwin linux,!android
 
 // TODO(crawshaw): Run tests on other OSs when more contexts are supported.
diff --git a/exp/gl/glutil/glutil.go b/exp/gl/glutil/glutil.go
index 5acafb5..18b0911 100644
--- a/exp/gl/glutil/glutil.go
+++ b/exp/gl/glutil/glutil.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build darwin || linux || windows
 // +build darwin linux windows
 
 package glutil // import "golang.org/x/mobile/exp/gl/glutil"
diff --git a/exp/sensor/android.go b/exp/sensor/android.go
index 8b36ded..ad8a98b 100644
--- a/exp/sensor/android.go
+++ b/exp/sensor/android.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build android
 // +build android
 
 package sensor
diff --git a/exp/sensor/darwin_armx.go b/exp/sensor/darwin_armx.go
index 52cfed7..2c8df04 100644
--- a/exp/sensor/darwin_armx.go
+++ b/exp/sensor/darwin_armx.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build darwin && (arm || arm64)
 // +build darwin
 // +build arm arm64
 
diff --git a/exp/sensor/notmobile.go b/exp/sensor/notmobile.go
index 1f8b0f0..3362e54 100644
--- a/exp/sensor/notmobile.go
+++ b/exp/sensor/notmobile.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build (linux && !android) || (darwin && !arm && !arm64) || windows
 // +build linux,!android darwin,!arm,!arm64 windows
 
 package sensor
diff --git a/exp/sprite/glsprite/glsprite.go b/exp/sprite/glsprite/glsprite.go
index 3282dae..4f2522b 100644
--- a/exp/sprite/glsprite/glsprite.go
+++ b/exp/sprite/glsprite/glsprite.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build darwin || linux || windows
 // +build darwin linux windows
 
 // Package glsprite implements a sprite Engine using OpenGL ES 2.
diff --git a/gl/gendebug.go b/gl/gendebug.go
index 625b626..2e6563c 100644
--- a/gl/gendebug.go
+++ b/gl/gendebug.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build ignore
 // +build ignore
 
 // The gendebug program takes gl.go and generates a version of it
diff --git a/gl/gl.go b/gl/gl.go
index 41dfef7..195a309 100644
--- a/gl/gl.go
+++ b/gl/gl.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build (darwin || linux || openbsd || windows) && !gldebug
 // +build darwin linux openbsd windows
 // +build !gldebug
 
diff --git a/gl/gldebug.go b/gl/gldebug.go
index 1639c1b..5a4bf71 100644
--- a/gl/gldebug.go
+++ b/gl/gldebug.go
@@ -5,6 +5,7 @@
 // Code generated from gl.go using go generate. DO NOT EDIT.
 // See doc.go for details.
 
+//go:build (darwin || linux || openbsd || windows) && gldebug
 // +build darwin linux openbsd windows
 // +build gldebug
 
diff --git a/gl/types_debug.go b/gl/types_debug.go
index 60c0afc..b6dbaaa 100644
--- a/gl/types_debug.go
+++ b/gl/types_debug.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build (darwin || linux || openbsd || windows) && gldebug
 // +build darwin linux openbsd windows
 // +build gldebug
 
diff --git a/gl/types_prod.go b/gl/types_prod.go
index 91c50f8..e1c8b42 100644
--- a/gl/types_prod.go
+++ b/gl/types_prod.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build (darwin || linux || openbsd || windows) && !gldebug
 // +build darwin linux openbsd windows
 // +build !gldebug
 
diff --git a/gl/work.go b/gl/work.go
index bf17394..73b566d 100644
--- a/gl/work.go
+++ b/gl/work.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build darwin || linux || openbsd
 // +build darwin linux openbsd
 
 package gl
diff --git a/gl/work_other.go b/gl/work_other.go
index b0f22fd..b4b48f4 100644
--- a/gl/work_other.go
+++ b/gl/work_other.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build (!cgo || (!darwin && !linux && !openbsd)) && !windows
 // +build !cgo !darwin,!linux,!openbsd
 // +build !windows
 
diff --git a/internal/binres/genarsc.go b/internal/binres/genarsc.go
index ec5e556..e93ae88 100644
--- a/internal/binres/genarsc.go
+++ b/internal/binres/genarsc.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build ignore
 // +build ignore
 
 // Genarsc generates stripped down version of android.jar resources used
diff --git a/internal/mobileinit/mobileinit_ios.go b/internal/mobileinit/mobileinit_ios.go
index dda9b0f..919097c 100644
--- a/internal/mobileinit/mobileinit_ios.go
+++ b/internal/mobileinit/mobileinit_ios.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build darwin && (arm || arm64)
 // +build darwin
 // +build arm arm64