Skip to content

Commit e4f3c67

Browse files
committed
go linter
1 parent 5359590 commit e4f3c67

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

scripts/translations/download.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package main
22

33
import (
4+
"bytes"
45
"context"
6+
"encoding/json"
57
"flag"
68
"fmt"
79
"io"
8-
"encoding/json"
9-
"bytes"
1010
"log/slog"
1111
"net/http"
1212
"net/url"
@@ -65,7 +65,7 @@ func (c *twoskyClient) downloadTo(
6565
client: &http.Client{
6666
Timeout: 10 * time.Second,
6767
},
68-
uriCh: uriCh,
68+
uriCh: uriCh,
6969
outputDir: outputDir,
7070
baseFile: baseFile,
7171
}
@@ -118,11 +118,11 @@ func printFailedLocales(
118118
// received from the channel to download translations and save them to files.
119119
// Failures are stored in the failed map. All fields must not be nil.
120120
type downloadWorker struct {
121-
ctx context.Context
122-
l *slog.Logger
123-
failed *syncutil.Map[string, struct{}]
124-
client *http.Client
125-
uriCh <-chan *url.URL
121+
ctx context.Context
122+
l *slog.Logger
123+
failed *syncutil.Map[string, struct{}]
124+
client *http.Client
125+
uriCh <-chan *url.URL
126126
outputDir string
127127
baseFile string
128128
}
@@ -158,8 +158,10 @@ func saveToFile(
158158
return fmt.Errorf("getting translation %q: %s", code, err)
159159
}
160160

161-
if baseFile == "services.json" {
162-
var wrapped map[string]struct{ Message string `json:"message"` }
161+
if baseFile == servicesBaseFile {
162+
var wrapped map[string]struct {
163+
Message string `json:"message"`
164+
}
163165
if err := json.Unmarshal(data, &wrapped); err == nil {
164166
flat := make(map[string]string, len(wrapped))
165167
for k, v := range wrapped {

scripts/translations/main.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ import (
2626
)
2727

2828
const (
29-
twoskyConfFile = "./.twosky.json"
30-
localesDir = "./client/src/__locales"
29+
twoskyConfFile = "./.twosky.json"
30+
localesDir = "./client/src/__locales"
3131
servicesLocalesDir = "./client/src/__locales-services"
32-
defaultBaseFile = "en.json"
33-
servicesBaseFile = "services.json"
34-
defaultProjectID = "home"
35-
srcDir = "./client/src"
36-
twoskyURI = "https://twosky.int.agrd.dev/api/v1"
32+
defaultBaseFile = "en.json"
33+
servicesBaseFile = "services.json"
34+
defaultProjectID = "home"
35+
srcDir = "./client/src"
36+
twoskyURI = "https://twosky.int.agrd.dev/api/v1"
3737

3838
readLimit = 1 * 1024 * 1024
3939
uploadTimeout = 20 * time.Second

0 commit comments

Comments
 (0)