Skip to content

Commit f86d919

Browse files
authored
refactor: package cleanup (#4808)
* feat(cosmosgen): fetch fallback buf token * package refactor * fix `CaptureException called with nil error` * cl * updates * updates * refactor: package cleanup * updates * remove script * cl * cl
1 parent 8e4e015 commit f86d919

File tree

29 files changed

+38
-1263
lines changed

29 files changed

+38
-1263
lines changed

changelog.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
## Unreleased
44

5+
## [`v29.4.1`](https://github.com/ignite/cli/releases/tag/v29.4.1)
6+
57
### Changes
68

7-
- [#4807](https://github.com/ignite/cli/pull/4807) Improve unconfigured path message when building a chain.
89
- [#4805](https://github.com/ignite/cli/pull/4805) Fetch fallback buf token.
10+
- [#4807](https://github.com/ignite/cli/pull/4807) Improve unconfigured path message when building a chain.
11+
- [#4808](https://github.com/ignite/cli/pull/4808) Remove unused packages.
912

1013
## [`v29.4.0`](https://github.com/ignite/cli/releases/tag/v29.4.0)
1114

ignite/cmd/ignite/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"github.com/ignite/cli/v29/ignite/pkg/cliui/colors"
1919
"github.com/ignite/cli/v29/ignite/pkg/cliui/icons"
2020
"github.com/ignite/cli/v29/ignite/pkg/errors"
21-
"github.com/ignite/cli/v29/ignite/pkg/validation"
2221
"github.com/ignite/cli/v29/ignite/pkg/xstrings"
2322
"github.com/ignite/cli/v29/ignite/version"
2423
)
@@ -64,7 +63,7 @@ func run() int {
6463

6564
if err != nil {
6665
var (
67-
validationErr validation.Error
66+
validationErr errors.ValidationError
6867
versionErr chainconfig.VersionError
6968
msg string
7069
)

ignite/cmd/scaffold_module.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010

1111
"github.com/ignite/cli/v29/ignite/pkg/cliui"
1212
"github.com/ignite/cli/v29/ignite/pkg/errors"
13-
"github.com/ignite/cli/v29/ignite/pkg/validation"
1413
"github.com/ignite/cli/v29/ignite/pkg/xgenny"
1514
"github.com/ignite/cli/v29/ignite/services/scaffolder"
1615
modulecreate "github.com/ignite/cli/v29/ignite/templates/module/create"
@@ -182,7 +181,7 @@ func scaffoldModuleHandler(cmd *cobra.Command, args []string) error {
182181
}
183182

184183
if err := sc.CreateModule(name, options...); err != nil {
185-
var validationErr validation.Error
184+
var validationErr errors.ValidationError
186185
if !requireRegistration && errors.As(err, &validationErr) {
187186
fmt.Fprintf(&msg, "Can't register module '%s'.\n", name)
188187
fmt.Fprintln(&msg, validationErr.ValidationInfo())

ignite/internal/analytics/analytics.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"github.com/ignite/cli/v29/ignite/internal/sentry"
1616
"github.com/ignite/cli/v29/ignite/pkg/cliui"
1717
"github.com/ignite/cli/v29/ignite/pkg/errors"
18-
"github.com/ignite/cli/v29/ignite/pkg/matomo"
1918
"github.com/ignite/cli/v29/ignite/pkg/randstr"
2019
"github.com/ignite/cli/v29/ignite/version"
2120
)
@@ -28,7 +27,7 @@ const (
2827
igniteAnonIdentity = "anon_identity.json"
2928
)
3029

31-
var matomoClient matomo.Client
30+
var matomoClient MatomoClient
3231

3332
// anonIdentity represents an analytics identity file.
3433
type anonIdentity struct {
@@ -39,10 +38,10 @@ type anonIdentity struct {
3938
}
4039

4140
func init() {
42-
matomoClient = matomo.New(
41+
matomoClient = NewMatomoClient(
4342
telemetryEndpoint,
44-
matomo.WithIDSite(4),
45-
matomo.WithSource("https://cli.ignite.com"),
43+
WithIDSite(4),
44+
WithSource("https://cli.ignite.com"),
4645
)
4746
}
4847

@@ -73,7 +72,7 @@ func SendMetric(wg *sync.WaitGroup, cmd *cobra.Command) {
7372
}
7473
}
7574

76-
met := matomo.Metric{
75+
met := Metric{
7776
Name: cmd.Name(),
7877
Cmd: path,
7978
ScaffoldType: scaffoldType,
Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// Package matomo is a client for Matomo to send data points for hint-type=event.
2-
package matomo
1+
package analytics
32

43
import (
54
"crypto/rand"
@@ -17,17 +16,17 @@ import (
1716
)
1817

1918
type (
20-
// Client is an analytics client.
21-
Client struct {
19+
// MatomoClient is a matomo client.
20+
MatomoClient struct {
2221
endpoint string
2322
idSite uint // Matomo ID Site.
2423
tokenAuth string // Matomo Token Auth.
2524
source string
2625
httpClient http.Client
2726
}
2827

29-
// Params analytics metrics body.
30-
Params struct {
28+
// MatomoParams analytics metrics body.
29+
MatomoParams struct {
3130
IDSite uint `url:"idsite"`
3231
Rec uint `url:"rec"`
3332
ActionName string `url:"action_name"`
@@ -121,32 +120,32 @@ type (
121120
)
122121

123122
// Option configures code generation.
124-
type Option func(*Client)
123+
type Option func(*MatomoClient)
125124

126125
// WithIDSite adds an id site.
127126
func WithIDSite(idSite uint) Option {
128-
return func(c *Client) {
127+
return func(c *MatomoClient) {
129128
c.idSite = idSite
130129
}
131130
}
132131

133132
// WithTokenAuth adds a matomo token authentication.
134133
func WithTokenAuth(tokenAuth string) Option {
135-
return func(c *Client) {
134+
return func(c *MatomoClient) {
136135
c.tokenAuth = tokenAuth
137136
}
138137
}
139138

140139
// WithSource adds a matomo URL source.
141140
func WithSource(source string) Option {
142-
return func(c *Client) {
141+
return func(c *MatomoClient) {
143142
c.source = source
144143
}
145144
}
146145

147-
// New creates a new Matomo client.
148-
func New(endpoint string, opts ...Option) Client {
149-
c := Client{
146+
// NewMatomoClient creates a new Matomo client.
147+
func NewMatomoClient(endpoint string, opts ...Option) MatomoClient {
148+
c := MatomoClient{
150149
endpoint: endpoint,
151150
source: endpoint,
152151
httpClient: http.Client{
@@ -161,7 +160,7 @@ func New(endpoint string, opts ...Option) Client {
161160
}
162161

163162
// Send sends metric event to analytics.
164-
func (c Client) Send(params Params) error {
163+
func (c MatomoClient) Send(params MatomoParams) error {
165164
requestURL, err := url.Parse(c.endpoint)
166165
if err != nil {
167166
return err
@@ -189,7 +188,7 @@ func (c Client) Send(params Params) error {
189188
}
190189

191190
// SendMetric build the metrics and send to analytics.
192-
func (c Client) SendMetric(sessionID string, metric Metric) error {
191+
func (c MatomoClient) SendMetric(sessionID string, metric Metric) error {
193192
var (
194193
now = time.Now()
195194
r, _ = rand.Int(rand.Reader, big.NewInt(math.MaxInt64))
@@ -201,7 +200,7 @@ func (c Client) SendMetric(sessionID string, metric Metric) error {
201200

202201
cmd := splitCommand(metric.Cmd)
203202

204-
return c.Send(Params{
203+
return c.Send(MatomoParams{
205204
IDSite: c.idSite,
206205
Rec: 1,
207206
APIVersion: 1,
@@ -261,6 +260,6 @@ func splitCommand(cmd string) []string {
261260
}
262261

263262
// metricURL build the metric URL.
264-
func (c Client) metricURL(cmd string) string {
263+
func (c MatomoClient) metricURL(cmd string) string {
265264
return fmt.Sprintf("%s/%s", c.source, strings.ReplaceAll(cmd, " ", "_"))
266265
}

ignite/pkg/cosmoserror/error.go

Lines changed: 0 additions & 40 deletions
This file was deleted.

ignite/pkg/cosmoserror/error_test.go

Lines changed: 0 additions & 88 deletions
This file was deleted.

ignite/pkg/cosmostestutil/sample/sample.go

Lines changed: 0 additions & 13 deletions
This file was deleted.

ignite/pkg/cosmostestutil/sample/sample_test.go

Lines changed: 0 additions & 16 deletions
This file was deleted.

ignite/pkg/cosmosutil/address.go

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)