Skip to content

Commit d8b65a7

Browse files
authored
chore: upgrade salt package (#181)
* chore: upgrade salt package * chore: upgrade dependencies * chore: module tidy * chore: fix lint issues * chore: fix lint issues * fix: upgrade linter * chore: golangci lint * chore: make empty build folder for lint
1 parent eb799d0 commit d8b65a7

24 files changed

Lines changed: 511 additions & 2034 deletions

.github/workflows/lint.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ on: [push, pull_request]
44

55
jobs:
66
golangci:
7-
name: "Lint Go"
7+
name: "Lint"
88
runs-on: "ubuntu-latest"
99
steps:
10-
- uses: actions/setup-go@v4
11-
with:
12-
go-version: "1.20"
13-
- uses: actions/checkout@v3
10+
- uses: actions/setup-go@v5
11+
- uses: actions/checkout@v4
12+
- name: Crete empty build directory
13+
run: mkdir ui/build && touch ui/build/.gitkeep
1414
- name: golangci-lint
15-
uses: golangci/golangci-lint-action@v3
15+
uses: golangci/golangci-lint-action@v6
1616
with:
17-
version: v1.54
17+
version: v1.64
1818

1919
codeql:
2020
name: "Analyze with CodeQL"

.golangci.yaml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
run:
22
timeout: 5m
3-
skip-dirs:
4-
- api/proto
5-
- clients/java
6-
- clients/js
7-
- docs
8-
- scripts
9-
- ui
103
output:
11-
format: line-number
4+
formats:
5+
- format: colored-line-number
126
linters:
137
enable-all: false
148
disable-all: true
159
enable:
16-
- vet
10+
- govet
1711
- goimports
1812
- thelper
1913
- tparallel
@@ -29,6 +23,13 @@ linters-settings:
2923
ignore-generated-header: true
3024
severity: warning
3125
issues:
26+
exclude-dirs:
27+
- api/proto
28+
- clients/java
29+
- clients/js
30+
- docs
31+
- scripts
32+
- ui
3233
fix: true
3334
severity:
3435
default-severity: error

cmd/check.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import (
77
"os"
88

99
"github.com/MakeNowJust/heredoc"
10-
"github.com/raystack/salt/printer"
11-
"github.com/raystack/salt/term"
10+
"github.com/raystack/salt/cli/printer"
1211
stencilv1beta1 "github.com/raystack/stencil/proto/raystack/stencil/v1beta1"
1312
"github.com/spf13/cobra"
1413
"google.golang.org/grpc/status"
@@ -57,7 +56,7 @@ func checkSchemaCmd(cdk *CDK) *cobra.Command {
5756
}
5857

5958
spinner.Stop()
60-
fmt.Printf("\n%s Schema is compatible.\n", term.Green(term.SuccessIcon()))
59+
fmt.Printf("\n%s Schema is compatible.\n", printer.Green(printer.Icon("success")))
6160
return nil
6261
},
6362
}

cmd/client.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ package cmd
22

33
import (
44
"context"
5-
"errors"
65
"time"
76

8-
"github.com/raystack/salt/cmdx"
97
"github.com/raystack/salt/config"
108
stencilv1beta1 "github.com/raystack/stencil/proto/raystack/stencil/v1beta1"
119
"github.com/spf13/cobra"
@@ -54,16 +52,13 @@ func createClient(cmd *cobra.Command, cdk *CDK) (stencilv1beta1.StencilServiceCl
5452
return client, cancel, nil
5553
}
5654

57-
func loadClientConfig(cmd *cobra.Command, cmdxConfig *cmdx.Config) (*ClientConfig, error) {
55+
func loadClientConfig(cmd *cobra.Command, cmdxConfig *config.Loader) (*ClientConfig, error) {
5856
var clientConfig ClientConfig
5957

6058
if err := cmdxConfig.Load(
6159
&clientConfig,
62-
cmdx.WithFlags(cmd.Flags()),
6360
); err != nil {
64-
if !errors.Is(err, new(config.ConfigFileNotFoundError)) {
65-
return nil, ErrClientConfigNotFound
66-
}
61+
return nil, err
6762
}
6863

6964
return &clientConfig, nil

cmd/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func configInitCommand(cdk *CDK) *cobra.Command {
3232
return err
3333
}
3434

35-
fmt.Printf("Config created: %v\n", cdk.Config.File())
35+
fmt.Printf("Config created\n")
3636
return nil
3737
},
3838
}
@@ -49,7 +49,7 @@ func configListCommand(cdk *CDK) *cobra.Command {
4949
"group": "core",
5050
},
5151
RunE: func(cmd *cobra.Command, args []string) error {
52-
data, err := cdk.Config.Read()
52+
data, err := cdk.Config.View()
5353
if err != nil {
5454
return ErrClientConfigNotFound
5555
}

cmd/create.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import (
77
"os"
88

99
"github.com/MakeNowJust/heredoc"
10-
"github.com/raystack/salt/printer"
11-
"github.com/raystack/salt/term"
10+
"github.com/raystack/salt/cli/printer"
1211
stencilv1beta1 "github.com/raystack/stencil/proto/raystack/stencil/v1beta1"
1312
"github.com/spf13/cobra"
1413
"google.golang.org/grpc/codes"
@@ -52,7 +51,7 @@ func createSchemaCmd(cdk *CDK) *cobra.Command {
5251
if err != nil {
5352
errStatus := status.Convert(err)
5453
if codes.AlreadyExists == errStatus.Code() {
55-
fmt.Printf("\n%s Schema with id '%s' already exist.\n", term.FailureIcon(), args[0])
54+
fmt.Printf("\n%s Schema with id '%s' already exist.\n", printer.Icon("failure"), args[0])
5655
return nil
5756
}
5857
return errors.New(errStatus.Message())
@@ -61,7 +60,7 @@ func createSchemaCmd(cdk *CDK) *cobra.Command {
6160
id := res.GetId()
6261

6362
spinner.Stop()
64-
fmt.Printf("\n%s Created schema with id %s.\n", term.Green(term.SuccessIcon()), term.Cyan(id))
63+
fmt.Printf("\n%s Created schema with id %s.\n", printer.Green(printer.Icon("success")), printer.Cyan(id))
6564
return nil
6665
},
6766
}

cmd/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"fmt"
66

77
"github.com/MakeNowJust/heredoc"
8-
"github.com/raystack/salt/printer"
8+
"github.com/raystack/salt/cli/printer"
99
stencilv1beta1 "github.com/raystack/stencil/proto/raystack/stencil/v1beta1"
1010
"github.com/spf13/cobra"
1111
)

cmd/diff.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"fmt"
77

88
"github.com/MakeNowJust/heredoc"
9-
"github.com/raystack/salt/printer"
9+
"github.com/raystack/salt/cli/printer"
1010
stencilv1beta1 "github.com/raystack/stencil/proto/raystack/stencil/v1beta1"
1111
"github.com/spf13/cobra"
1212
"github.com/yudai/gojsondiff"

cmd/download.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import (
55
"os"
66

77
"github.com/MakeNowJust/heredoc"
8-
"github.com/raystack/salt/printer"
9-
"github.com/raystack/salt/term"
8+
"github.com/raystack/salt/cli/printer"
109
"github.com/spf13/cobra"
1110
)
1211

@@ -42,7 +41,7 @@ func downloadSchemaCmd(cdk *CDK) *cobra.Command {
4241
return err
4342
}
4443

45-
fmt.Printf("%s Schema successfully written to %s\n", term.Green(term.SuccessIcon()), output)
44+
fmt.Printf("%s Schema successfully written to %s\n", printer.Green(printer.Icon("success")), output)
4645
return nil
4746
},
4847
}

cmd/edit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"fmt"
66

77
"github.com/MakeNowJust/heredoc"
8-
"github.com/raystack/salt/printer"
8+
"github.com/raystack/salt/cli/printer"
99
stencilv1beta1 "github.com/raystack/stencil/proto/raystack/stencil/v1beta1"
1010
"github.com/spf13/cobra"
1111
)

0 commit comments

Comments
 (0)