aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-12-15 00:29:05 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2021-12-16 03:14:14 +0100
commita3534b576f72deef16fcd4c1e7524d9e49fbf74c (patch)
tree7ff2bd514c21b129fe44edf7ae9d9df0436be55a
parentbuild: omit build info from binary (diff)
downloadwireguard-windows-a3534b576f72deef16fcd4c1e7524d9e49fbf74c.tar.xz
wireguard-windows-a3534b576f72deef16fcd4c1e7524d9e49fbf74c.zip
global: interface{} -> any
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--conf/parser_test.go6
-rw-r--r--l18n/l18n.go2
-rw-r--r--main.go8
-rw-r--r--manager/ipc_server.go2
-rw-r--r--ui/listview.go2
-rw-r--r--ui/logpage.go2
-rw-r--r--ui/syntax/syntaxedit.go4
7 files changed, 13 insertions, 13 deletions
diff --git a/conf/parser_test.go b/conf/parser_test.go
index da8539ab..157c8a5d 100644
--- a/conf/parser_test.go
+++ b/conf/parser_test.go
@@ -45,7 +45,7 @@ func noError(t *testing.T, err error) bool {
return false
}
-func equal(t *testing.T, expected, actual interface{}) bool {
+func equal(t *testing.T, expected, actual any) bool {
if reflect.DeepEqual(expected, actual) {
return true
}
@@ -54,7 +54,7 @@ func equal(t *testing.T, expected, actual interface{}) bool {
return false
}
-func lenTest(t *testing.T, actualO interface{}, expected int) bool {
+func lenTest(t *testing.T, actualO any, expected int) bool {
actual := reflect.ValueOf(actualO).Len()
if reflect.DeepEqual(expected, actual) {
return true
@@ -64,7 +64,7 @@ func lenTest(t *testing.T, actualO interface{}, expected int) bool {
return false
}
-func contains(t *testing.T, list, element interface{}) bool {
+func contains(t *testing.T, list, element any) bool {
listValue := reflect.ValueOf(list)
for i := 0; i < listValue.Len(); i++ {
if reflect.DeepEqual(listValue.Index(i).Interface(), element) {
diff --git a/l18n/l18n.go b/l18n/l18n.go
index 4af5cfdb..a8af8744 100644
--- a/l18n/l18n.go
+++ b/l18n/l18n.go
@@ -52,7 +52,7 @@ func lang() (tag language.Tag) {
}
// Sprintf is like fmt.Sprintf, but using language-specific formatting.
-func Sprintf(key message.Reference, a ...interface{}) string {
+func Sprintf(key message.Reference, a ...any) string {
return prn().Sprintf(key, a...)
}
diff --git a/main.go b/main.go
index 1f031345..40c6f7cf 100644
--- a/main.go
+++ b/main.go
@@ -41,20 +41,20 @@ func setLogFile() {
}
}
-func fatal(v ...interface{}) {
+func fatal(v ...any) {
if log.Writer() == io.Discard {
windows.MessageBox(0, windows.StringToUTF16Ptr(fmt.Sprint(v...)), windows.StringToUTF16Ptr(l18n.Sprintf("Error")), windows.MB_ICONERROR)
os.Exit(1)
} else {
- log.Fatal(append([]interface{}{l18n.Sprintf("Error: ")}, v...))
+ log.Fatal(append([]any{l18n.Sprintf("Error: ")}, v...))
}
}
-func fatalf(format string, v ...interface{}) {
+func fatalf(format string, v ...any) {
fatal(l18n.Sprintf(format, v...))
}
-func info(title, format string, v ...interface{}) {
+func info(title, format string, v ...any) {
if log.Writer() == io.Discard {
windows.MessageBox(0, windows.StringToUTF16Ptr(l18n.Sprintf(format, v...)), windows.StringToUTF16Ptr(title), windows.MB_ICONINFORMATION)
} else {
diff --git a/manager/ipc_server.go b/manager/ipc_server.go
index bb36c649..d51aba0e 100644
--- a/manager/ipc_server.go
+++ b/manager/ipc_server.go
@@ -461,7 +461,7 @@ func IPCServerListen(reader, writer, events *os.File, elevatedToken windows.Toke
}()
}
-func notifyAll(notificationType NotificationType, adminOnly bool, ifaces ...interface{}) {
+func notifyAll(notificationType NotificationType, adminOnly bool, ifaces ...any) {
if len(managerServices) == 0 {
return
}
diff --git a/ui/listview.go b/ui/listview.go
index 428d8330..b0c320f1 100644
--- a/ui/listview.go
+++ b/ui/listview.go
@@ -32,7 +32,7 @@ func (t *ListModel) RowCount() int {
return len(t.tunnels)
}
-func (t *ListModel) Value(row, col int) interface{} {
+func (t *ListModel) Value(row, col int) any {
if col != 0 || row < 0 || row >= len(t.tunnels) {
return ""
}
diff --git a/ui/logpage.go b/ui/logpage.go
index 17c3c8f0..3eeacac1 100644
--- a/ui/logpage.go
+++ b/ui/logpage.go
@@ -216,6 +216,6 @@ func newLogModel(lp *LogPage) *logModel {
return mdl
}
-func (mdl *logModel) Items() interface{} {
+func (mdl *logModel) Items() any {
return mdl.items
}
diff --git a/ui/syntax/syntaxedit.go b/ui/syntax/syntaxedit.go
index 18b51436..e52f60a8 100644
--- a/ui/syntax/syntaxedit.go
+++ b/ui/syntax/syntaxedit.go
@@ -477,10 +477,10 @@ func NewSyntaxEdit(parent walk.Container) (*SyntaxEdit, error) {
se.GraphicsEffects().Add(walk.InteractionEffect)
se.GraphicsEffects().Add(walk.FocusEffect)
se.MustRegisterProperty("Text", walk.NewProperty(
- func() interface{} {
+ func() any {
return se.Text()
},
- func(v interface{}) error {
+ func(v any) error {
if s, ok := v.(string); ok {
return se.SetText(s)
}