Skip to content

Commit

Permalink
ref: remove extendio (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
plastikfan committed Aug 24, 2024
1 parent 34215e3 commit 08a3d01
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 146 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: 1.22
go-version: 1.23
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.56.2
version: v1.60.3
args: --verbose

test:
strategy:
matrix:
go-version: [1.22]
go-version: [1.23]
platform: [ubuntu-latest, macos-latest]

runs-on: ${{ matrix.platform }}

steps:
- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup
uses: actions/setup-go@v3
with:
go-version: '>=1.22'
go-version: '>=1.23'
cache: true
- name: Generate Changelog Only
uses: goreleaser/goreleaser-action@v4
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"Malloc",
"mattn",
"nakedret",
"nicksnyder",
"nolint",
"nolintlint",
"Nonblocking",
Expand Down
15 changes: 6 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
module github.com/snivilised/pants

go 1.22.0
go 1.23.0

require (
github.com/nicksnyder/go-i18n/v2 v2.4.0
github.com/onsi/ginkgo/v2 v2.20.0
github.com/onsi/gomega v1.34.1
github.com/snivilised/extendio v0.7.0
)

require (
github.com/avfs/avfs v0.33.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/nicksnyder/go-i18n/v2 v2.4.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/samber/lo v1.39.0 // indirect
github.com/snivilised/lorax v0.6.1 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sys v0.23.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/tools v0.24.0 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
28 changes: 4 additions & 24 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/avfs/avfs v0.33.0 h1:5WQXbUbr6VS7aani39ZN2Vrd/s3wLnyih1Sc4ExWTxs=
github.com/avfs/avfs v0.33.0/go.mod h1:Q59flcFRYe9KYkNMfrLUJney3yeKGQpcWRyxsDBW7vI=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
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=
Expand All @@ -13,48 +11,30 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 h1:FKHo8hFI3A+7w0aUQuYXQ+6EN5stWmeY/AZqtM8xk9k=
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
github.com/nicksnyder/go-i18n/v2 v2.4.0 h1:3IcvPOAvnCKwNm0TB0dLDTuawWEj+ax/RERNC+diLMM=
github.com/nicksnyder/go-i18n/v2 v2.4.0/go.mod h1:nxYSZE9M0bf3Y70gPQjN9ha7XNHX7gMc814+6wVyEI4=
github.com/onsi/ginkgo/v2 v2.20.0 h1:PE84V2mHqoT1sglvHc8ZdQtPcwmvvt29WLEEO3xmdZw=
github.com/onsi/ginkgo/v2 v2.20.0/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI=
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
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/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
github.com/samber/lo v1.39.0 h1:4gTz1wUhNYLhFSKl6O+8peW0v2F4BCY034GRpU9WnuA=
github.com/samber/lo v1.39.0/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA=
github.com/snivilised/extendio v0.7.0 h1:MY6w9qCK5wVEvP2WpMT5ywJwpDJe97WHDGuwrsTLpek=
github.com/snivilised/extendio v0.7.0/go.mod h1:l8MwJOy9ojMQYJrSKRbQS3WfDylevnRtBp/zwAmFEKc=
github.com/snivilised/lorax v0.6.1 h1:U3OnSsGjDdsQfHyxB3TMGX/zwxepafM6YnPXMCPJS9E=
github.com/snivilised/lorax v0.6.1/go.mod h1:pEvn+FDo7DkUwhDQq3XAqajSHdbjgC/6H9mcBI67NsU=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
go.uber.org/zap/exp v0.2.0 h1:FtGenNNeCATRB3CmB/yEUnjEFeJWpB/pMcy7e2bKPYs=
go.uber.org/zap/exp v0.2.0/go.mod h1:t0gqAIdh1MfKv9EwN/dLwfZnJxe9ITAZN78HEWPFWDQ=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI=
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
Expand Down
File renamed without changes.
104 changes: 50 additions & 54 deletions locale/messages-errors.go
Original file line number Diff line number Diff line change
@@ -1,56 +1,52 @@
package locale

import (
"github.com/snivilised/extendio/i18n"
)

// ❌ FooBar

// FooBarTemplData - TODO: this is a none existent error that should be
// replaced by the client. Its just defined here to illustrate the pattern
// that should be used to implement i18n with extendio. Also note,
// that this message has been removed from the translation files, so
// it is not useable at run time.
type FooBarTemplData struct {
pantsTemplData
Path string
Reason error
}

// the ID should use spp/library specific code, so replace astrolib with the
// name of the library implementing this template project.
func (td FooBarTemplData) Message() *i18n.Message {
return &i18n.Message{
ID: "foo-bar.astrolib.nav",
Description: "Foo Bar description",
Other: "foo bar failure '{{.Path}}' (reason: {{.Reason}})",
}
}

// FooBarErrorBehaviourQuery used to query if an error is:
// "Failed to read directory contents from the path specified"
type FooBarErrorBehaviourQuery interface {
FooBar() bool
}

type FooBarError struct {
i18n.LocalisableError
}

// FooBar enables the client to check if error is FooBarError
// via FooBarErrorBehaviourQuery
func (e FooBarError) FooBar() bool {
return true
}

// NewFooBarError creates a FooBarError
func NewFooBarError(path string, reason error) FooBarError {
return FooBarError{
LocalisableError: i18n.LocalisableError{
Data: FooBarTemplData{
Path: path,
Reason: reason,
},
},
}
}
// // ❌ FooBar

// // FooBarTemplData - TODO: this is a none existent error that should be
// // replaced by the client. Its just defined here to illustrate the pattern
// // that should be used to implement i18n with extendio. Also note,
// // that this message has been removed from the translation files, so
// // it is not useable at run time.
// type FooBarTemplData struct {
// pantsTemplData
// Path string
// Reason error
// }

// // the ID should use spp/library specific code, so replace astrolib with the
// // name of the library implementing this template project.
// func (td FooBarTemplData) Message() *i18n.Message {
// return &i18n.Message{
// ID: "foo-bar.astrolib.nav",
// Description: "Foo Bar description",
// Other: "foo bar failure '{{.Path}}' (reason: {{.Reason}})",
// }
// }

// // FooBarErrorBehaviourQuery used to query if an error is:
// // "Failed to read directory contents from the path specified"
// type FooBarErrorBehaviourQuery interface {
// FooBar() bool
// }

// type FooBarError struct {
// i18n.LocalisableError
// }

// // FooBar enables the client to check if error is FooBarError
// // via FooBarErrorBehaviourQuery
// func (e FooBarError) FooBar() bool {
// return true
// }

// // NewFooBarError creates a FooBarError
// func NewFooBarError(path string, reason error) FooBarError {
// return FooBarError{
// LocalisableError: i18n.LocalisableError{
// Data: FooBarTemplData{
// Path: path,
// Reason: reason,
// },
// },
// }
// }
2 changes: 1 addition & 1 deletion locale/messages-general.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package locale

import (
"github.com/snivilised/extendio/i18n"
"github.com/nicksnyder/go-i18n/v2/i18n"
)

type UsingConfigFileTemplData struct {
Expand Down
50 changes: 0 additions & 50 deletions locale/test-i18n-messages_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion test/data/l10n/test.graffico.active.en-US.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"pavement-graffiti-report.graffico.unit-test": {
"pavement-graffiti-report.graffico.test": {
"description": "Report of graffiti found on a pavement",
"hash": "sha1-69c428d6be2dc281d00f095218e1ed7671d1c984",
"other": "Found graffiti on sidewalk; primary color: '{{.Primary}}'"
Expand Down
2 changes: 1 addition & 1 deletion test/data/l10n/test.pants.active.en-US.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"foo-bar.astrolib.unit-test": {
"foo-bar.astrolib.test": {
"description": "foo bar",
"hash": "sha1-d53a205a336e07cf9eac45471b3870f9489288ec",
"other": "foo bar"
Expand Down

0 comments on commit 08a3d01

Please sign in to comment.