@@ -10,7 +10,7 @@ import (
10
10
"encoding/json"
11
11
"encoding/xml"
12
12
"fmt"
13
- "io/ioutil "
13
+ "io"
14
14
"log"
15
15
"net/http"
16
16
"os"
@@ -263,7 +263,7 @@ func fetchCLDR(dir string) (string, error) {
263
263
return "" , err
264
264
}
265
265
266
- data , err := ioutil .ReadFile (dir + "/cldr-json/cldr-core/package.json" )
266
+ data , err := os .ReadFile (dir + "/cldr-json/cldr-core/package.json" )
267
267
if err != nil {
268
268
return "" , fmt .Errorf ("fetchCLDR: %w" , err )
269
269
}
@@ -331,7 +331,7 @@ func fetchURL(url string) ([]byte, error) {
331
331
if resp .StatusCode != http .StatusOK {
332
332
return nil , fmt .Errorf ("fetchURL: Get %q: %v" , url , resp .Status )
333
333
}
334
- data , err := ioutil .ReadAll (resp .Body )
334
+ data , err := io .ReadAll (resp .Body )
335
335
if err != nil {
336
336
return nil , fmt .Errorf ("fetchURL: Get %q: %w" , url , err )
337
337
}
@@ -347,7 +347,7 @@ func fetchURL(url string) ([]byte, error) {
347
347
// Note that CLDR does not have data for every currency, in which ase
348
348
// the original ISO digits are kept.
349
349
func replaceDigits (currencies map [string ]* currencyInfo , dir string ) error {
350
- data , err := ioutil .ReadFile (dir + "/cldr-json/cldr-core/supplemental/currencyData.json" )
350
+ data , err := os .ReadFile (dir + "/cldr-json/cldr-core/supplemental/currencyData.json" )
351
351
if err != nil {
352
352
return fmt .Errorf ("replaceDigits: %w" , err )
353
353
}
@@ -377,7 +377,7 @@ func replaceDigits(currencies map[string]*currencyInfo, dir string) error {
377
377
// Symbols are grouped by locale, and deduplicated by parent.
378
378
func generateSymbols (currencies map [string ]* currencyInfo , dir string ) (map [string ]symbolInfoSlice , error ) {
379
379
symbols := make (map [string ]map [string ][]string )
380
- files , err := ioutil .ReadDir (dir + "/cldr-json/cldr-numbers-modern/main" )
380
+ files , err := os .ReadDir (dir + "/cldr-json/cldr-numbers-modern/main" )
381
381
if err != nil {
382
382
return nil , fmt .Errorf ("generateSymbols: %w" , err )
383
383
}
@@ -490,7 +490,7 @@ func generateSymbols(currencies map[string]*currencyInfo, dir string) (map[strin
490
490
// Discards symbols belonging to inactive currencies.
491
491
func readSymbols (currencies map [string ]* currencyInfo , dir string , locale string ) (map [string ]string , error ) {
492
492
filename := fmt .Sprintf ("%v/cldr-json/cldr-numbers-modern/main/%v/currencies.json" , dir , locale )
493
- data , err := ioutil .ReadFile (filename )
493
+ data , err := os .ReadFile (filename )
494
494
if err != nil {
495
495
return nil , fmt .Errorf ("readSymbols: %w" , err )
496
496
}
@@ -526,7 +526,7 @@ func readSymbols(currencies map[string]*currencyInfo, dir string, locale string)
526
526
// Formats are deduplicated by parent.
527
527
func generateFormats (dir string ) (map [string ]currencyFormat , error ) {
528
528
formats := make (map [string ]currencyFormat )
529
- files , err := ioutil .ReadDir (dir + "/cldr-json/cldr-numbers-modern/main" )
529
+ files , err := os .ReadDir (dir + "/cldr-json/cldr-numbers-modern/main" )
530
530
if err != nil {
531
531
return nil , fmt .Errorf ("generateFormats: %w" , err )
532
532
}
@@ -561,7 +561,7 @@ func generateFormats(dir string) (map[string]currencyFormat, error) {
561
561
// readFormat reads the given locale's currency format from CLDR data.
562
562
func readFormat (dir string , locale string ) (currencyFormat , error ) {
563
563
filename := fmt .Sprintf ("%v/cldr-json/cldr-numbers-modern/main/%v/numbers.json" , dir , locale )
564
- data , err := ioutil .ReadFile (filename )
564
+ data , err := os .ReadFile (filename )
565
565
if err != nil {
566
566
return currencyFormat {}, fmt .Errorf ("readFormat: %w" , err )
567
567
}
@@ -674,7 +674,7 @@ func readFormat(dir string, locale string) (currencyFormat, error) {
674
674
// Ensures ignored locales are skipped.
675
675
// Replaces "und" with "en", since this package treats them as equivalent.
676
676
func generateParentLocales (dir string ) (map [string ]string , error ) {
677
- data , err := ioutil .ReadFile (dir + "/cldr-json/cldr-core/supplemental/parentLocales.json" )
677
+ data , err := os .ReadFile (dir + "/cldr-json/cldr-core/supplemental/parentLocales.json" )
678
678
if err != nil {
679
679
return nil , fmt .Errorf ("generateParentLocales: %w" , err )
680
680
}
0 commit comments