Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use std lib errors #1

Merged
merged 3 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ jobs:
name: Test
strategy:
matrix:
go-version: [1.19.x]
go-version: [1.20.x, 1.21.x, 1.22.x]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v1
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

Expand All @@ -21,6 +21,6 @@ jobs:

- name: Upload coverage
if: success()
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
3 changes: 1 addition & 2 deletions cmd/localesdump/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

"github.com/nyaruka/go-locales"
"github.com/nyaruka/go-locales/localedata"
"github.com/pkg/errors"
)

// matches locale codes in the form xx_YY or xxx_YY
Expand Down Expand Up @@ -89,7 +88,7 @@ func extractData(mappings map[string]string) (map[string]localeDump, error) {

ops, err := locales.Query(code, localedata.LC(category), keyword)
if err != nil {
return nil, errors.Wrapf(err, "error querying path %s", path)
return nil, fmt.Errorf("error querying path %s: %w", path, err)
}

locale[key] = ops
Expand Down
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ module github.com/nyaruka/go-locales

go 1.19

require (
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.8.4
)
require github.com/stretchr/testify v1.8.4

require (
github.com/davecgh/go-spew v1.1.1 // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
Expand Down
5 changes: 2 additions & 3 deletions localedata/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"strconv"

"github.com/nyaruka/go-locales/fdcc"
"github.com/pkg/errors"
)

// from https://sourceware.org/git/?p=glibc.git;a=tree;f=localedata/locales
Expand Down Expand Up @@ -73,7 +72,7 @@ func LoadDatabase() (*Database, error) {

file, err := static.Open(fmt.Sprintf("locales/%s", code))
if err != nil {
return nil, errors.Wrapf(err, "unable to open file %s", code)
return nil, fmt.Errorf("unable to open file %s: %w", code, err)
}

defer file.Close()
Expand All @@ -82,7 +81,7 @@ func LoadDatabase() (*Database, error) {

set, err := p.Parse()
if err != nil {
return nil, errors.Wrapf(err, "unable to parse file %s", code)
return nil, fmt.Errorf("unable to parse file %s: %w", code, err)
}

locales[code] = newLocale(set)
Expand Down
Loading