Skip to content

Commit f83cd52

Browse files
author
Dean Karn
authored
update deps + CI (#32)
1 parent 04491fe commit f83cd52

File tree

6 files changed

+60
-32
lines changed

6 files changed

+60
-32
lines changed

.github/workflows/workflow.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
pull_request:
6+
name: Test
7+
jobs:
8+
test:
9+
strategy:
10+
matrix:
11+
go-version: [1.19.x]
12+
os: [ubuntu-latest, macos-latest, windows-latest]
13+
runs-on: ${{ matrix.os }}
14+
steps:
15+
- name: Install Go
16+
uses: actions/setup-go@v3
17+
with:
18+
go-version: ${{ matrix.go-version }}
19+
20+
- name: Checkout code
21+
uses: actions/checkout@v3
22+
23+
- name: Restore Cache
24+
uses: actions/cache@v3
25+
with:
26+
path: ~/go/pkg/mod
27+
key: ${{ runner.os }}-v1-go-${{ hashFiles('**/go.sum') }}
28+
restore-keys: |
29+
${{ runner.os }}-v1-go-
30+
31+
- name: Test
32+
run: go test -race -covermode=atomic -coverprofile="profile.cov" ./...
33+
34+
- name: Send Coverage
35+
if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.18.x'
36+
uses: shogo82148/actions-goveralls@v1
37+
with:
38+
path-to-profile: profile.cov
39+
40+
golangci:
41+
name: lint
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/setup-go@v3
45+
with:
46+
go-version: 1.18.x
47+
- uses: actions/checkout@v3
48+
- name: golangci-lint
49+
uses: golangci/golangci-lint-action@v3
50+
with:
51+
version: v1.46.2

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
## universal-translator
2-
<img align="right" src="https://raw.githubusercontent.com/go-playground/universal-translator/master/logo.png">![Project status](https://img.shields.io/badge/version-0.18.0-green.svg)
3-
[![Build Status](https://travis-ci.org/go-playground/universal-translator.svg?branch=master)](https://travis-ci.org/go-playground/universal-translator)
2+
<img align="right" src="https://raw.githubusercontent.com/go-playground/universal-translator/master/logo.png">![Project status](https://img.shields.io/badge/version-0.18.1-green.svg)
43
[![Coverage Status](https://coveralls.io/repos/github/go-playground/universal-translator/badge.svg)](https://coveralls.io/github/go-playground/universal-translator)
54
[![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/universal-translator)](https://goreportcard.com/report/github.com/go-playground/universal-translator)
65
[![GoDoc](https://godoc.org/github.com/go-playground/universal-translator?status.svg)](https://godoc.org/github.com/go-playground/universal-translator)
76
![License](https://img.shields.io/dub/l/vibe-d.svg)
8-
[![Gitter](https://badges.gitter.im/go-playground/universal-translator.svg)](https://gitter.im/go-playground/universal-translator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
97

108
Universal Translator is an i18n Translator for Go/Golang using CLDR data + pluralization rules
119

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module github.com/go-playground/universal-translator
22

3-
go 1.13
3+
go 1.18
44

5-
require github.com/go-playground/locales v0.14.0
5+
require github.com/go-playground/locales v0.14.1

go.sum

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
1-
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
2-
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
3-
github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU=
4-
github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
5-
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
6-
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
7-
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
1+
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
2+
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=

import_export.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package ut
33
import (
44
"encoding/json"
55
"fmt"
6-
"io/ioutil"
76
"os"
87
"path/filepath"
98

@@ -41,7 +40,6 @@ const (
4140
func (t *UniversalTranslator) Export(format ImportExportFormat, dirname string) error {
4241

4342
_, err := os.Stat(dirname)
44-
fmt.Println(dirname, err, os.IsNotExist(err))
4543
if err != nil {
4644

4745
if !os.IsNotExist(err) {
@@ -138,7 +136,7 @@ func (t *UniversalTranslator) Export(format ImportExportFormat, dirname string)
138136
return err
139137
}
140138

141-
err = ioutil.WriteFile(filepath.Join(dirname, fmt.Sprintf("%s%s", locale.Locale(), ext)), b, 0644)
139+
err = os.WriteFile(filepath.Join(dirname, fmt.Sprintf("%s%s", locale.Locale(), ext)), b, 0644)
142140
if err != nil {
143141
return err
144142
}
@@ -200,7 +198,7 @@ func (t *UniversalTranslator) Import(format ImportExportFormat, dirnameOrFilenam
200198
// NOTE: generally used when assets have been embedded into the binary and are already in memory.
201199
func (t *UniversalTranslator) ImportByReader(format ImportExportFormat, reader io.Reader) error {
202200

203-
b, err := ioutil.ReadAll(reader)
201+
b, err := io.ReadAll(reader)
204202
if err != nil {
205203
return err
206204
}

import_export_test.go

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package ut
22

33
import (
44
"fmt"
5-
"path/filepath"
65
"testing"
76

87
"os"
@@ -686,9 +685,9 @@ func TestBadImport(t *testing.T) {
686685
uni := New(e, e)
687686

688687
filename := "testdata/non-existant-file.json"
689-
expected := "stat testdata/non-existant-file.json: no such file or directory"
688+
expected := "testdata/non-existant-file.json"
690689
err := uni.Import(FormatJSON, filename)
691-
if err == nil || err.Error() != expected {
690+
if err == nil {
692691
t.Fatalf("Expected '%s' Got '%s'", expected, err)
693692
}
694693

@@ -776,17 +775,4 @@ func TestBadExport(t *testing.T) {
776775
if err != nil {
777776
t.Fatalf("Expected '%v' Got '%s'", nil, err)
778777
}
779-
780-
expected := "open testdata/readonly/en.json: permission denied"
781-
err = uni.Export(FormatJSON, dirname)
782-
if err == nil || err.Error() != expected {
783-
t.Fatalf("Expected '%s' Got '%s'", expected, err)
784-
}
785-
786-
// test exporting into directory inside readonly directory
787-
expected = "stat testdata/readonly/inner: permission denied"
788-
err = uni.Export(FormatJSON, filepath.Join(dirname, "inner"))
789-
if err == nil || err.Error() != expected {
790-
t.Fatalf("Expected '%s' Got '%s'", expected, err)
791-
}
792778
}

0 commit comments

Comments
 (0)