aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/gotext.go
diff options
context:
space:
mode:
Diffstat (limited to 'gotext.go')
-rw-r--r--gotext.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/gotext.go b/gotext.go
index d61ce393..db39bdd3 100644
--- a/gotext.go
+++ b/gotext.go
@@ -1,16 +1,16 @@
-// +build generate
+//go:build generate
+
//go:generate go run gotext.go
/* SPDX-License-Identifier: MIT
*
- * Copyright (C) 2020 WireGuard LLC. All Rights Reserved.
+ * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved.
*/
package main
import (
"encoding/json"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -20,7 +20,7 @@ import (
)
func main() {
- langDirs, err := ioutil.ReadDir("locales")
+ langDirs, err := os.ReadDir("locales")
if err != nil {
panic(err)
}
@@ -30,7 +30,7 @@ func main() {
continue
}
lang := dir.Name()
- if jsonData, err := ioutil.ReadFile(filepath.Join("locales", lang, "messages.gotext.json")); err == nil {
+ if jsonData, err := os.ReadFile(filepath.Join("locales", lang, "messages.gotext.json")); err == nil {
var translations pipeline.Messages
if err := json.Unmarshal(jsonData, &translations); err != nil {
panic(err)
@@ -50,7 +50,7 @@ func main() {
if len(langs) == 0 {
panic("no locales found")
}
- gotext, err := ioutil.TempFile("", "gotext*.exe")
+ gotext, err := os.CreateTemp("", "gotext*.exe")
if err != nil {
panic(err)
}
@@ -65,7 +65,7 @@ func main() {
panic(err)
}
cmd = exec.Command(gotextFilename, "-srclang=en", "update", "-out=zgotext.go", "-lang="+strings.Join(langs, ","))
- cmd.Env = append(os.Environ(), "GOOS=windows", "GOARCH=amd64", "CGO_ENABLED=1", "CC=x86_64-w64-mingw32-gcc")
+ cmd.Env = append(os.Environ(), "GOOS=windows", "GOARCH=amd64")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err = cmd.Run()