diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index c28f54a..302d21b 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -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 }} diff --git a/.github/workflows/release-workflow.yml b/.github/workflows/release-workflow.yml index e88f666..2833ee5 100644 --- a/.github/workflows/release-workflow.yml +++ b/.github/workflows/release-workflow.yml @@ -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 diff --git a/.vscode/settings.json b/.vscode/settings.json index 40ee067..6a0dbdc 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -44,6 +44,7 @@ "Malloc", "mattn", "nakedret", + "nicksnyder", "nolint", "nolintlint", "Nonblocking", diff --git a/go.mod b/go.mod index 200741a..17b3515 100644 --- a/go.mod +++ b/go.mod @@ -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 ) diff --git a/go.sum b/go.sum index 13d83df..f6fd67c 100644 --- a/go.sum +++ b/go.sum @@ -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= @@ -13,14 +11,10 @@ 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= @@ -28,33 +22,19 @@ github.com/onsi/ginkgo/v2 v2.20.0/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VF 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= diff --git a/locale/locale_suite_test.go b/locale/locale-suite_test.go similarity index 100% rename from locale/locale_suite_test.go rename to locale/locale-suite_test.go diff --git a/locale/messages-errors.go b/locale/messages-errors.go index 79f2686..4ae579c 100644 --- a/locale/messages-errors.go +++ b/locale/messages-errors.go @@ -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, +// }, +// }, +// } +// } diff --git a/locale/messages-general.go b/locale/messages-general.go index c3456d5..557d2cd 100644 --- a/locale/messages-general.go +++ b/locale/messages-general.go @@ -1,7 +1,7 @@ package locale import ( - "github.com/snivilised/extendio/i18n" + "github.com/nicksnyder/go-i18n/v2/i18n" ) type UsingConfigFileTemplData struct { diff --git a/locale/test-i18n-messages_test.go b/locale/test-i18n-messages_test.go deleted file mode 100644 index acf1b3c..0000000 --- a/locale/test-i18n-messages_test.go +++ /dev/null @@ -1,50 +0,0 @@ -package locale_test - -import ( - "github.com/snivilised/extendio/i18n" -) - -const ( - GrafficoSourceID = "github.com/snivilised/graffico" -) - -type GrafficoData struct{} - -func (td GrafficoData) SourceID() string { - return GrafficoSourceID -} - -// 🧊 Pavement Graffiti Report - -// PavementGraffitiReportTemplData -type PavementGraffitiReportTemplData struct { - GrafficoData - Primary string -} - -func (td PavementGraffitiReportTemplData) Message() *i18n.Message { - return &i18n.Message{ - ID: "pavement-graffiti-report.graffico.unit-test", - Description: "Report of graffiti found on a pavement", - Other: "Found graffiti on pavement; primary colour: '{{.Primary}}'", - } -} - -// ☢️ Wrong Source Id - -// WrongSourceIDTemplData -type WrongSourceIDTemplData struct { - GrafficoData -} - -func (td WrongSourceIDTemplData) SourceID() string { - return "FOO-BAR" -} - -func (td WrongSourceIDTemplData) Message() *i18n.Message { - return &i18n.Message{ - ID: "wrong-source-id.graffico.unit-test", - Description: "Incorrect Source Id for which doesn't match the one n the localizer", - Other: "Message with wrong id", - } -} diff --git a/test/data/l10n/test.graffico.active.en-US.json b/test/data/l10n/test.graffico.active.en-US.json index fbf0305..01f3a65 100644 --- a/test/data/l10n/test.graffico.active.en-US.json +++ b/test/data/l10n/test.graffico.active.en-US.json @@ -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}}'" diff --git a/test/data/l10n/test.pants.active.en-US.json b/test/data/l10n/test.pants.active.en-US.json index cdca24b..5a7a30b 100644 --- a/test/data/l10n/test.pants.active.en-US.json +++ b/test/data/l10n/test.pants.active.en-US.json @@ -1,5 +1,5 @@ { - "foo-bar.astrolib.unit-test": { + "foo-bar.astrolib.test": { "description": "foo bar", "hash": "sha1-d53a205a336e07cf9eac45471b3870f9489288ec", "other": "foo bar"