Skip to content

Commit

Permalink
ref: remove extendio (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
plastikfan committed Oct 25, 2024
1 parent 2d01fd0 commit 9d81b62
Show file tree
Hide file tree
Showing 13 changed files with 122 additions and 83 deletions.
52 changes: 39 additions & 13 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Astrolib Continuous Integration

on:
push:

Expand All @@ -7,43 +8,68 @@ 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 }}

env:
COVER_DIR: ${{ github.workspace }}/coverage
COVER_FILE: coverage.out
COVER_OUT_PATH: ${{ github.workspace }}/coverage/coverage.out
COVER_HTML_PATH: ${{ github.workspace }}/coverage/coverage.html
GINKGO_REPORT: ginkgo.report

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

- name: Install goveralls
run: go install github.com/mattn/goveralls@latest

- name: Install ginkgo
run: go install github.com/onsi/ginkgo/v2/[email protected]

- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- run: go test -v -coverprofile=coverage.out ./...
- name: Ensure coverage directory exists
run: |
mkdir -p ${{ github.workspace }}/coverage
- name: Run tests and generate coverage profile with Ginkgo
run: |
ginkgo run -r -json-report {{env.GINKGO_REPORT}} -coverpkg=./... -coverprofile=coverage.out
- uses: shogo82148/actions-goveralls@v1
- name: Apply coverage exclusions
run: |
${{ github.workspace }}/scripts/apply-coverage-exclusions.sh
- name: Check coverage directory contents
run: |
echo "Contents of ${{ github.workspace }}/coverage:"
ls -la ${{ github.workspace }}/coverage
- name: Generate HTML coverage report
run: |
go tool cover -html=coverage.out -o ${{ github.workspace }}/coverage/coverage.html
- name: Upload coverage to Coveralls
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: coverage.out

- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: goveralls -coverprofile=coverage.out -service=github
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
6 changes: 3 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ linters-settings:
- performance
- style
govet:
check-shadowing: true
shadow: true
disable:
- fieldalignment # too strict

Expand All @@ -28,22 +28,22 @@ linters:
# it can be re-enabled.
# https://github.com/OpenPeeDeeP/depguard#example-configs
# - depguard
- copyloopvar
- dogsled
# - dupl
- errcheck
- exportloopref
- exhaustive
- goconst
- gocritic
- gofmt
- goimports
- gomnd
- gocyclo
- gosec
- gosimple
- govet
- ineffassign
- misspell
- mnd
- nolintlint
- nakedret
- prealloc
Expand Down
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"astrolib",
"bodyclose",
"cmds",
"copyloopvar",
"coverpkg",
"coverprofile",
"cubiest",
Expand All @@ -17,7 +18,6 @@
"dupl",
"errcheck",
"exportloopref",
"extendio",
"fieldalignment",
"goconst",
"gocritic",
Expand All @@ -38,6 +38,7 @@
"linters",
"mattn",
"nakedret",
"nicksnyder",
"nolint",
"nolintlint",
"onsi",
Expand All @@ -47,6 +48,7 @@
"repotoken",
"shogo",
"sidewalk",
"snivilised",
"staticcheck",
"structcheck",
"stylecheck",
Expand Down
23 changes: 11 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
module github.com/snivilised/astrolib

go 1.22.0
go 1.23.0

require (
github.com/nicksnyder/go-i18n/v2 v2.4.1
github.com/onsi/ginkgo/v2 v2.20.2
github.com/onsi/gomega v1.34.2
github.com/snivilised/extendio v0.7.0
github.com/snivilised/li18ngo v0.1.7
)

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-20240827171923-fa2c70bbbfe5 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/nicksnyder/go-i18n/v2 v2.4.0 // indirect
github.com/google/pprof v0.0.0-20241023014458-598669927662 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/samber/lo v1.39.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/net v0.28.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
github.com/snivilised/nefilim v0.1.4 // indirect
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect
golang.org/x/net v0.30.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/tools v0.26.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
58 changes: 20 additions & 38 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/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
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 @@ -11,60 +9,44 @@ github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1v
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
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-20240827171923-fa2c70bbbfe5 h1:5iH8iuqE5apketRbSFBy+X1V0o+l+8NF1avt4HWl7cA=
github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
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/google/pprof v0.0.0-20241023014458-598669927662 h1:SKMkD83p7FwUqKmBsPdLHF5dNyxq3jOWwu9w9UyH5vA=
github.com/google/pprof v0.0.0-20241023014458-598669927662/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
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/nicksnyder/go-i18n/v2 v2.4.1 h1:zwzjtX4uYyiaU02K5Ia3zSkpJZrByARkRB4V3YPrr0g=
github.com/nicksnyder/go-i18n/v2 v2.4.1/go.mod h1:++Pl70FR6Cki7hdzZRnEEqdc2dJt+SAGotyFg/SvZMk=
github.com/onsi/ginkgo/v2 v2.20.2 h1:7NVCeyIWROIAheY21RLS+3j2bb52W0W82tkberYytp4=
github.com/onsi/ginkgo/v2 v2.20.2/go.mod h1:K9gyxPIlb+aIvnZ8bd9Ak+YP18w3APlR+5coaZoE2ag=
github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8=
github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1Dukc=
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.5.2 h1:iReIJl63tydiPSSD0YzsNQFX1CctmvMkYx0aSxoZJKo=
github.com/snivilised/lorax v0.5.2/go.mod h1:7H1JPgSn4h4p8NSqfl64raacYefdm/FiFkfcZ51PVHY=
github.com/snivilised/li18ngo v0.1.7 h1:XRYpmP7jSAxzRyg5WH0PViFb9ycWGFcDkQQqd2GsjzQ=
github.com/snivilised/li18ngo v0.1.7/go.mod h1:NVOexqt/aIhnenNPQDqbJchLNte92io87j5o2l+HNqs=
github.com/snivilised/nefilim v0.1.4 h1:bhiENDl/T6ZQO146eF8UnxtXLQenSzEyjwuTeWScImw=
github.com/snivilised/nefilim v0.1.4/go.mod h1:+4/hKxgfvE8eNjLMJC+3ropEZSQuiR/NqfPtIuw7ZMw=
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/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
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=
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY=
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8=
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package helpers
package lab

import (
"fmt"
Expand Down
4 changes: 2 additions & 2 deletions locale/i18n_suite_test.go → locale/locale-suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
. "github.com/onsi/gomega" //nolint:revive // gomega ok
)

func TestI18n(t *testing.T) {
func TestLocale(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "I18n Suite")
RunSpecs(t, "Locale Suite")
}
15 changes: 5 additions & 10 deletions locale/messages-errors.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package locale

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

// ❌ 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 should be used to implement i18n with li18ngo. Also note,
// that this message has been removed from the translation files, so
// it is not useable at run time.
type FooBarTemplData struct {
Expand All @@ -27,14 +28,8 @@ func (td FooBarTemplData) Message() *i18n.Message {
}
}

// 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
li18ngo.LocalisableError
}

// FooBar enables the client to check if error is FooBarError
Expand All @@ -46,7 +41,7 @@ func (e FooBarError) FooBar() bool {
// NewFooBarError creates a FooBarError
func NewFooBarError(path string, reason error) FooBarError {
return FooBarError{
LocalisableError: i18n.LocalisableError{
LocalisableError: li18ngo.LocalisableError{
Data: FooBarTemplData{
Path: path,
Reason: reason,
Expand Down
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
2 changes: 1 addition & 1 deletion locale/test-i18n-messages_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package locale_test

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

const (
Expand Down
Loading

0 comments on commit 9d81b62

Please sign in to comment.