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: Id0f07c94a24a65e20ea98a91dc18965e17f1b0ff Reviewed-on: https://go-review.googlesource.com/c/exp/+/294418 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Robert Griesemer <gri@golang.org>
diff --git a/cmd/macos-roots-test/main.go b/cmd/macos-roots-test/main.go index 0f79d25..db2bfe6 100644 --- a/cmd/macos-roots-test/main.go +++ b/cmd/macos-roots-test/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 // +build darwin // Command macOS-roots-test runs crypto/x509.TestSystemRoots as a
diff --git a/cmd/macos-roots-test/root_nocgo_darwin.go b/cmd/macos-roots-test/root_nocgo_darwin.go index bb338a1..cdf44d4 100644 --- a/cmd/macos-roots-test/root_nocgo_darwin.go +++ b/cmd/macos-roots-test/root_nocgo_darwin.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 // +build !cgo package main
diff --git a/io/i2c/devfs.go b/io/i2c/devfs.go index 7456610..3c7704f 100644 --- a/io/i2c/devfs.go +++ b/io/i2c/devfs.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 // +build linux package i2c
diff --git a/io/i2c/devfs_nonlinux.go b/io/i2c/devfs_nonlinux.go index 74a6faf..619fb9f 100644 --- a/io/i2c/devfs_nonlinux.go +++ b/io/i2c/devfs_nonlinux.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 // +build !linux package i2c
diff --git a/io/spi/devfs.go b/io/spi/devfs.go index 04b54c3..bc421fa 100644 --- a/io/spi/devfs.go +++ b/io/spi/devfs.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 // +build linux package spi
diff --git a/io/spi/devfs_nonlinux.go b/io/spi/devfs_nonlinux.go index 0b0a2ec..6b30abc 100644 --- a/io/spi/devfs_nonlinux.go +++ b/io/spi/devfs_nonlinux.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 // +build !linux package spi
diff --git a/mmap/manual_test_program.go b/mmap/manual_test_program.go index 1278afd..a1ab17b 100644 --- a/mmap/manual_test_program.go +++ b/mmap/manual_test_program.go
@@ -2,7 +2,9 @@ // 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 + // // This build tag means that "go build" does not build this file. Use "go run // manual_test_program.go" to run it.
diff --git a/mmap/mmap_other.go b/mmap/mmap_other.go index c2e0d5b..1e7b948 100644 --- a/mmap/mmap_other.go +++ b/mmap/mmap_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 !linux && !windows && !darwin // +build !linux,!windows,!darwin // Package mmap provides a way to memory-map a file.
diff --git a/mmap/mmap_unix.go b/mmap/mmap_unix.go index 4426137..ae12499 100644 --- a/mmap/mmap_unix.go +++ b/mmap/mmap_unix.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 mmap provides a way to memory-map a file.
diff --git a/rand/regress_test.go b/rand/regress_test.go index ace8107..e3a8f6e 100644 --- a/rand/regress_test.go +++ b/rand/regress_test.go
@@ -383,19 +383,19 @@ float64(0.5201256313962235), // NormFloat64() float64(1.3826174159276245), // NormFloat64() - []int{}, // Perm(0) - []int{0}, // Perm(1) - []int{0, 2, 3, 1, 4}, // Perm(5) - []int{5, 6, 3, 7, 4, 2, 0, 1}, // Perm(8) - []int{8, 4, 5, 2, 7, 3, 0, 6, 1}, // Perm(9) - []int{6, 1, 5, 3, 2, 9, 7, 0, 8, 4}, // Perm(10) + []int{}, // Perm(0) + []int{0}, // Perm(1) + []int{0, 2, 3, 1, 4}, // Perm(5) + []int{5, 6, 3, 7, 4, 2, 0, 1}, // Perm(8) + []int{8, 4, 5, 2, 7, 3, 0, 6, 1}, // Perm(9) + []int{6, 1, 5, 3, 2, 9, 7, 0, 8, 4}, // Perm(10) []int{12, 5, 1, 9, 15, 7, 13, 6, 10, 11, 8, 0, 4, 2, 14, 3}, // Perm(16) - []int{}, // Perm(0) - []int{0}, // Perm(1) - []int{0, 2, 3, 4, 1}, // Perm(5) - []int{3, 2, 7, 4, 0, 6, 5, 1}, // Perm(8) - []int{0, 6, 2, 1, 3, 7, 5, 8, 4}, // Perm(9) - []int{2, 5, 6, 4, 7, 3, 0, 8, 1, 9}, // Perm(10) + []int{}, // Perm(0) + []int{0}, // Perm(1) + []int{0, 2, 3, 4, 1}, // Perm(5) + []int{3, 2, 7, 4, 0, 6, 5, 1}, // Perm(8) + []int{0, 6, 2, 1, 3, 7, 5, 8, 4}, // Perm(9) + []int{2, 5, 6, 4, 7, 3, 0, 8, 1, 9}, // Perm(10) []int{3, 6, 5, 4, 9, 15, 13, 7, 1, 11, 10, 8, 12, 0, 2, 14}, // Perm(16) []int{}, // Perm(0) []int{0}, // Perm(1) @@ -414,7 +414,7 @@ []byte{0x4, 0xf2, 0xf, 0x13, 0x96, 0x1a, 0xb2, 0xce}, // Read([0 0 0 0 0 0 0 0]) []byte{0x35, 0xf5, 0xde, 0x9f, 0x7d, 0xa0, 0x19, 0x12, 0x2e}, // Read([0 0 0 0 0 0 0 0 0]) []byte{0xd4, 0xee, 0x6f, 0x66, 0x6f, 0x32, 0xc8, 0x21, 0x57, 0x68}, // Read([0 0 0 0 0 0 0 0 0 0]) - []byte{0x1f}, // Read([0]) + []byte{0x1f}, // Read([0]) []byte{0x98, 0xda, 0x4d, 0xab, 0x6e, 0xd, 0x71}, // Read([0 0 0 0 0 0 0]) []byte{0x80, 0xad, 0x29, 0xa0, 0x37, 0xb0, 0x80, 0xc4}, // Read([0 0 0 0 0 0 0 0]) []byte{0x2, 0xe2, 0xe2, 0x7, 0xd9, 0xed, 0xea, 0x90, 0x33}, // Read([0 0 0 0 0 0 0 0 0])
diff --git a/shiny/driver/driver_darwin.go b/shiny/driver/driver_darwin.go index ee59ac6..3eebcf7 100644 --- a/shiny/driver/driver_darwin.go +++ b/shiny/driver/driver_darwin.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 && !metal // +build darwin,!metal package driver
diff --git a/shiny/driver/driver_fallback.go b/shiny/driver/driver_fallback.go index 450aef8..e36fbc5 100644 --- a/shiny/driver/driver_fallback.go +++ b/shiny/driver/driver_fallback.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 && !dragonfly && !openbsd // +build !darwin // +build !linux android // +build !windows
diff --git a/shiny/driver/driver_x11.go b/shiny/driver/driver_x11.go index cd91d38..bc24238 100644 --- a/shiny/driver/driver_x11.go +++ b/shiny/driver/driver_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) || dragonfly || openbsd // +build linux,!android dragonfly openbsd package driver
diff --git a/shiny/driver/gldriver/cocoa.go b/shiny/driver/gldriver/cocoa.go index 130b2a5..e13ac80 100644 --- a/shiny/driver/gldriver/cocoa.go +++ b/shiny/driver/gldriver/cocoa.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 gldriver
diff --git a/shiny/driver/gldriver/context.go b/shiny/driver/gldriver/context.go index 197be35..274d799 100644 --- a/shiny/driver/gldriver/context.go +++ b/shiny/driver/gldriver/context.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 gldriver
diff --git a/shiny/driver/gldriver/other.go b/shiny/driver/gldriver/other.go index 30ef2ed..0a04425 100644 --- a/shiny/driver/gldriver/other.go +++ b/shiny/driver/gldriver/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 (!darwin || ios || !cgo) && (!linux || android || !cgo) && (!openbsd || !cgo) && !windows // +build !darwin ios !cgo // +build !linux android !cgo // +build !openbsd !cgo
diff --git a/shiny/driver/gldriver/win32.go b/shiny/driver/gldriver/win32.go index 343fb45..8ece242 100755 --- a/shiny/driver/gldriver/win32.go +++ b/shiny/driver/gldriver/win32.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 gldriver
diff --git a/shiny/driver/gldriver/x11.go b/shiny/driver/gldriver/x11.go index 7aaeaff..4847e85 100644 --- a/shiny/driver/gldriver/x11.go +++ b/shiny/driver/gldriver/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) || openbsd // +build linux,!android openbsd package gldriver
diff --git a/shiny/driver/internal/swizzle/swizzle_other.go b/shiny/driver/internal/swizzle/swizzle_other.go index 5f3264d..f1c2726 100644 --- a/shiny/driver/internal/swizzle/swizzle_other.go +++ b/shiny/driver/internal/swizzle/swizzle_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 !amd64 // +build !amd64 package swizzle
diff --git a/shiny/driver/internal/win32/key.go b/shiny/driver/internal/win32/key.go index cb8f6e5..a5748c3 100644 --- a/shiny/driver/internal/win32/key.go +++ b/shiny/driver/internal/win32/key.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 win32
diff --git a/shiny/driver/internal/win32/win32.go b/shiny/driver/internal/win32/win32.go index 4fe6696..22a6013 100644 --- a/shiny/driver/internal/win32/win32.go +++ b/shiny/driver/internal/win32/win32.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 win32 implements a partial shiny screen driver using the Win32 API. @@ -331,10 +332,10 @@ _WM_MOUSEMOVE: sendMouseEvent, _WM_MOUSEWHEEL: sendMouseEvent, - _WM_KEYDOWN: sendKeyEvent, - _WM_KEYUP: sendKeyEvent, + _WM_KEYDOWN: sendKeyEvent, + _WM_KEYUP: sendKeyEvent, _WM_SYSKEYDOWN: sendKeyEvent, - _WM_SYSKEYUP: sendKeyEvent, + _WM_SYSKEYUP: sendKeyEvent, } func AddWindowMsg(fn func(hwnd syscall.Handle, uMsg uint32, wParam, lParam uintptr)) uint32 {
diff --git a/shiny/driver/internal/x11key/gen.go b/shiny/driver/internal/x11key/gen.go index 218586b..4af0660 100644 --- a/shiny/driver/internal/x11key/gen.go +++ b/shiny/driver/internal/x11key/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 // This program generates the table keysymCodePoints from /usr/include/X11/keysymdef.h
diff --git a/shiny/driver/mtldriver/buffer.go b/shiny/driver/mtldriver/buffer.go index c9a10ed..987d75a 100644 --- a/shiny/driver/mtldriver/buffer.go +++ b/shiny/driver/mtldriver/buffer.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 // +build darwin package mtldriver
diff --git a/shiny/driver/mtldriver/internal/appkit/appkit.go b/shiny/driver/mtldriver/internal/appkit/appkit.go index 9bdf038..7140f6f 100644 --- a/shiny/driver/mtldriver/internal/appkit/appkit.go +++ b/shiny/driver/mtldriver/internal/appkit/appkit.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 // +build darwin // Package appkit provides access to Apple's AppKit API
diff --git a/shiny/driver/mtldriver/internal/coreanim/coreanim.go b/shiny/driver/mtldriver/internal/coreanim/coreanim.go index f146a69..257b783 100644 --- a/shiny/driver/mtldriver/internal/coreanim/coreanim.go +++ b/shiny/driver/mtldriver/internal/coreanim/coreanim.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 // +build darwin // Package coreanim provides access to Apple's Core Animation API
diff --git a/shiny/driver/mtldriver/mtldriver.go b/shiny/driver/mtldriver/mtldriver.go index 16ebeef..a926b92 100644 --- a/shiny/driver/mtldriver/mtldriver.go +++ b/shiny/driver/mtldriver/mtldriver.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 // +build darwin // Package mtldriver provides a Metal driver for accessing a screen.
diff --git a/shiny/driver/mtldriver/screen.go b/shiny/driver/mtldriver/screen.go index 1828a4c..544de7c 100644 --- a/shiny/driver/mtldriver/screen.go +++ b/shiny/driver/mtldriver/screen.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 // +build darwin package mtldriver
diff --git a/shiny/driver/mtldriver/texture.go b/shiny/driver/mtldriver/texture.go index 6a60dfd..60185ee 100644 --- a/shiny/driver/mtldriver/texture.go +++ b/shiny/driver/mtldriver/texture.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 // +build darwin package mtldriver
diff --git a/shiny/driver/mtldriver/window.go b/shiny/driver/mtldriver/window.go index 55f5a42..7bbb837 100644 --- a/shiny/driver/mtldriver/window.go +++ b/shiny/driver/mtldriver/window.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 // +build darwin package mtldriver
diff --git a/shiny/driver/mtldriver_darwin.go b/shiny/driver/mtldriver_darwin.go index d94e633..a30cd27 100644 --- a/shiny/driver/mtldriver_darwin.go +++ b/shiny/driver/mtldriver_darwin.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 && metal // +build darwin,metal package driver
diff --git a/shiny/driver/windriver/buffer.go b/shiny/driver/windriver/buffer.go index a55fd38..eeff378 100644 --- a/shiny/driver/windriver/buffer.go +++ b/shiny/driver/windriver/buffer.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 windriver
diff --git a/shiny/driver/windriver/other.go b/shiny/driver/windriver/other.go index ebc09a6..2da4c44 100644 --- a/shiny/driver/windriver/other.go +++ b/shiny/driver/windriver/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 !windows // +build !windows package windriver
diff --git a/shiny/driver/windriver/screen.go b/shiny/driver/windriver/screen.go index 3e84345..148b4ef 100644 --- a/shiny/driver/windriver/screen.go +++ b/shiny/driver/windriver/screen.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 windriver
diff --git a/shiny/driver/windriver/texture.go b/shiny/driver/windriver/texture.go index 0155a66..6fbfff5 100644 --- a/shiny/driver/windriver/texture.go +++ b/shiny/driver/windriver/texture.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 windriver
diff --git a/shiny/driver/windriver/window.go b/shiny/driver/windriver/window.go index c66cd47..9577f2c 100644 --- a/shiny/driver/windriver/window.go +++ b/shiny/driver/windriver/window.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 windriver
diff --git a/shiny/driver/windriver/windraw.go b/shiny/driver/windriver/windraw.go index 363b733..b5e6b15 100644 --- a/shiny/driver/windriver/windraw.go +++ b/shiny/driver/windriver/windraw.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 windriver
diff --git a/shiny/driver/windriver/windriver.go b/shiny/driver/windriver/windriver.go index 9f3bfa3..73a5420 100644 --- a/shiny/driver/windriver/windriver.go +++ b/shiny/driver/windriver/windriver.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 windriver
diff --git a/shiny/driver/x11driver/shm_linux_ipc.go b/shiny/driver/x11driver/shm_linux_ipc.go index 025f3ff..23fe9a4 100644 --- a/shiny/driver/x11driver/shm_linux_ipc.go +++ b/shiny/driver/x11driver/shm_linux_ipc.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 && (386 || ppc64 || ppc64le || s390x) // +build linux // +build 386 ppc64 ppc64le s390x
diff --git a/shiny/driver/x11driver/shm_openbsd_syscall.go b/shiny/driver/x11driver/shm_openbsd_syscall.go index 573c78b..d42cb4c 100644 --- a/shiny/driver/x11driver/shm_openbsd_syscall.go +++ b/shiny/driver/x11driver/shm_openbsd_syscall.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 openbsd && (i386 || amd64) // +build openbsd // +build i386 amd64
diff --git a/shiny/driver/x11driver/shm_other.go b/shiny/driver/x11driver/shm_other.go index d09994f..fa071c3 100644 --- a/shiny/driver/x11driver/shm_other.go +++ b/shiny/driver/x11driver/shm_other.go
@@ -2,9 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !linux -// +build !dragonfly -// +build !openbsd +//go:build !linux && !dragonfly && !openbsd +// +build !linux,!dragonfly,!openbsd package x11driver
diff --git a/shiny/driver/x11driver/shm_shmopen_syscall.go b/shiny/driver/x11driver/shm_shmopen_syscall.go index 23f9026..45d7373 100644 --- a/shiny/driver/x11driver/shm_shmopen_syscall.go +++ b/shiny/driver/x11driver/shm_shmopen_syscall.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 || dragonfly) && (amd64 || arm || arm64 || mips64 || mips64le) // +build linux dragonfly // +build amd64 arm arm64 mips64 mips64le
diff --git a/shiny/materialdesign/colornames/gen.go b/shiny/materialdesign/colornames/gen.go index c3bc430..3969d8b 100644 --- a/shiny/materialdesign/colornames/gen.go +++ b/shiny/materialdesign/colornames/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 // This program generates table.go from
diff --git a/shiny/materialdesign/icons/gen.go b/shiny/materialdesign/icons/gen.go index c738c60..b67a606 100644 --- a/shiny/materialdesign/icons/gen.go +++ b/shiny/materialdesign/icons/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/shiny/widget/glwidget/glwidget.go b/shiny/widget/glwidget/glwidget.go index cfbacbe..3122377 100644 --- a/shiny/widget/glwidget/glwidget.go +++ b/shiny/widget/glwidget/glwidget.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 glwidget provides a widget containing a GL ES framebuffer.
diff --git a/shiny/widget/node/node.go b/shiny/widget/node/node.go index d995f60..89893f5 100644 --- a/shiny/widget/node/node.go +++ b/shiny/widget/node/node.go
@@ -199,7 +199,9 @@ func (m *LeafEmbed) Remove(c Node) { m.remove(c) } -func (m *LeafEmbed) Measure(t *theme.Theme, widthHint, heightHint int) { m.MeasuredSize = image.Point{} } +func (m *LeafEmbed) Measure(t *theme.Theme, widthHint, heightHint int) { + m.MeasuredSize = image.Point{} +} func (m *LeafEmbed) Layout(t *theme.Theme) {}