Skip to content

Commit ef1235f

Browse files
authored
chore: udpate dependencies (#882)
* asd * asd
1 parent 5542e23 commit ef1235f

File tree

386 files changed

+9624
-4101
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

386 files changed

+9624
-4101
lines changed

Diff for: .golangci.yaml

+2-10
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,9 @@ linters:
66
- gomoddirectives
77
- nlreturn
88
- wsl
9-
- exhaustivestruct # deprecated
10-
- maligned # deprecated
11-
- scopelint # deprecated
12-
- interfacer # deprecated
13-
- golint # deprecated
14-
- structcheck # deprecated
15-
- deadcode # deprecated
16-
- nosnakecase # deprecated
17-
- ifshort # deprecated
18-
- varcheck # deprecated
199
- depguard
10+
- gomnd
11+
- execinquery
2012

2113
issues:
2214
exclude-rules:

Diff for: clienv/table.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func Table(columns ...Column) string {
1212
Border(lipgloss.NormalBorder(), false, true, false, false).
1313
BorderForeground(ANSIColorGray).
1414
Padding(1)
15-
// Width(30 + 1) //nolint:gomnd
15+
// Width(30 + 1) //nolint:mnd
1616

1717
listHeader := lipgloss.NewStyle().
1818
Foreground(ANSIColorPurple).

Diff for: clienv/wf_link.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package clienv
33
import (
44
"context"
55
"encoding/json"
6+
"errors"
67
"fmt"
78
"os"
89
"strconv"
@@ -12,7 +13,7 @@ import (
1213

1314
func printlist(ce *CliEnv, workspaces []*graphql.GetWorkspacesApps_Workspaces) error {
1415
if len(workspaces) == 0 {
15-
return fmt.Errorf("no workspaces found") //nolint:goerr113
16+
return errors.New("no workspaces found") //nolint:goerr113
1617
}
1718

1819
num := Column{
@@ -59,7 +60,7 @@ func confirmApp(ce *CliEnv, app *graphql.GetWorkspacesApps_Workspaces_Apps) erro
5960
}
6061

6162
if confirm != app.Subdomain {
62-
return fmt.Errorf("input doesn't match the subdomain") //nolint:goerr113
63+
return errors.New("input doesn't match the subdomain") //nolint:goerr113
6364
}
6465

6566
return nil
@@ -84,7 +85,7 @@ OUTER:
8485
}
8586

8687
if app == nil {
87-
return nil, fmt.Errorf("invalid input") //nolint:goerr113
88+
return nil, errors.New("invalid input") //nolint:goerr113
8889
}
8990

9091
return app, nil
@@ -101,7 +102,7 @@ func (ce *CliEnv) Link(ctx context.Context) (*graphql.GetWorkspacesApps_Workspac
101102
}
102103

103104
if len(workspaces.GetWorkspaces()) == 0 {
104-
return nil, fmt.Errorf("no workspaces found") //nolint:goerr113
105+
return nil, errors.New("no workspaces found") //nolint:goerr113
105106
}
106107

107108
if err := printlist(ce, workspaces.GetWorkspaces()); err != nil {
@@ -123,7 +124,7 @@ func (ce *CliEnv) Link(ctx context.Context) (*graphql.GetWorkspacesApps_Workspac
123124
return nil, err
124125
}
125126

126-
if err := os.MkdirAll(ce.Path.DotNhostFolder(), 0o755); err != nil { //nolint:gomnd
127+
if err := os.MkdirAll(ce.Path.DotNhostFolder(), 0o755); err != nil { //nolint:mnd
127128
return nil, fmt.Errorf("failed to create .nhost folder: %w", err)
128129
}
129130

Diff for: clienv/wf_login.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func savePAT(
2828
) error {
2929
dir := filepath.Dir(ce.Path.AuthFile())
3030
if !PathExists(dir) {
31-
if err := os.MkdirAll(dir, 0o755); err != nil { //nolint:gomnd
31+
if err := os.MkdirAll(dir, 0o755); err != nil { //nolint:mnd
3232
return fmt.Errorf("failed to create dir: %w", err)
3333
}
3434
}
@@ -76,7 +76,7 @@ func getTLSServer() (*http.Server, error) {
7676
// Type assert the private key to crypto.PrivateKey
7777
pk, ok := privateKey.(crypto.PrivateKey)
7878
if !ok {
79-
return nil, fmt.Errorf( //nolint:goerr113
79+
return nil, errors.New( //nolint:goerr113
8080
"failed to type assert private key to crypto.PrivateKey",
8181
)
8282
}
@@ -101,7 +101,7 @@ func getTLSServer() (*http.Server, error) {
101101
return &http.Server{ //nolint:exhaustruct
102102
Addr: ":8099",
103103
TLSConfig: tlsConfig,
104-
ReadHeaderTimeout: time.Second * 10, //nolint:gomnd
104+
ReadHeaderTimeout: time.Second * 10, //nolint:mnd
105105
}, nil
106106
}
107107

Diff for: clienv/wf_marshal.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
package clienv
22

33
import (
4+
"errors"
45
"fmt"
56
"io"
67
"os"
78
)
89

9-
var ErrNoContent = fmt.Errorf("no content")
10+
var ErrNoContent = errors.New("no content")
1011

1112
func UnmarshalFile(filepath string, v any, f func([]byte, any) error) error {
12-
r, err := os.OpenFile(filepath, os.O_RDONLY, 0o600) //nolint:gomnd
13+
r, err := os.OpenFile(filepath, os.O_RDONLY, 0o600) //nolint:mnd
1314
if err != nil {
1415
return fmt.Errorf("failed to open file: %w", err)
1516
}
@@ -32,7 +33,7 @@ func UnmarshalFile(filepath string, v any, f func([]byte, any) error) error {
3233
}
3334

3435
func MarshalFile(v any, filepath string, fn func(any) ([]byte, error)) error {
35-
f, err := os.OpenFile(filepath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o600) //nolint:gomnd
36+
f, err := os.OpenFile(filepath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o600) //nolint:mnd
3637
if err != nil {
3738
return fmt.Errorf("failed to open file: %w", err)
3839
}

Diff for: cmd/config/default.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func CommandDefault() *cli.Command {
2424
func commandDefault(cCtx *cli.Context) error {
2525
ce := clienv.FromCLI(cCtx)
2626

27-
if err := os.MkdirAll(ce.Path.NhostFolder(), 0o755); err != nil { //nolint:gomnd
27+
if err := os.MkdirAll(ce.Path.NhostFolder(), 0o755); err != nil { //nolint:mnd
2828
return fmt.Errorf("failed to create nhost folder: %w", err)
2929
}
3030

Diff for: cmd/config/edit.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func GenerateJSONPatch(origfilepath, newfilepath, dst string) error {
117117
return fmt.Errorf("failed to generate json patch: %w", err)
118118
}
119119

120-
dstf, err := os.OpenFile(dst, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0o644) //nolint:gomnd
120+
dstf, err := os.OpenFile(dst, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0o644) //nolint:mnd
121121
if err != nil {
122122
return fmt.Errorf("failed to open destination file: %w", err)
123123
}
@@ -149,7 +149,7 @@ func edit(cCtx *cli.Context) error {
149149
return nil
150150
}
151151

152-
if err := os.MkdirAll(ce.Path.OverlaysFolder(), 0o755); err != nil { //nolint:gomnd
152+
if err := os.MkdirAll(ce.Path.OverlaysFolder(), 0o755); err != nil { //nolint:mnd
153153
return fmt.Errorf("failed to create json patches directory: %w", err)
154154
}
155155

Diff for: cmd/config/example.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func ptr[T any](v T) *T { return &v }
2525
func commandExample(cCtx *cli.Context) error { //nolint:funlen,maintidx
2626
ce := clienv.FromCLI(cCtx)
2727

28-
//nolint:gomnd
28+
//nolint:mnd
2929
cfg := model.ConfigConfig{
3030
Global: &model.ConfigGlobal{
3131
Environment: []*model.ConfigGlobalEnvironmentVariable{
@@ -357,7 +357,7 @@ func commandExample(cCtx *cli.Context) error { //nolint:funlen,maintidx
357357
Password: "smtpPassword",
358358
Sender: "smtpSender",
359359
Host: "smtpHost",
360-
Port: 587, //nolint:gomnd
360+
Port: 587, //nolint:mnd
361361
Secure: true,
362362
Method: "LOGIN",
363363
},

Diff for: cmd/config/pull.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package config
33
import (
44
"context"
55
"encoding/json"
6+
"errors"
67
"fmt"
78
"os"
89

@@ -76,14 +77,14 @@ func commandPull(cCtx *cli.Context) error {
7677
func verifyFile(ce *clienv.CliEnv, name string) error {
7778
if clienv.PathExists(name) {
7879
ce.PromptMessage(
79-
fmt.Sprintf("%s already exists. Do you want to overwrite it? [y/N] ", name),
80+
name + " already exists. Do you want to overwrite it? [y/N] ",
8081
)
8182
resp, err := ce.PromptInput(false)
8283
if err != nil {
8384
return fmt.Errorf("failed to read input: %w", err)
8485
}
8586
if resp != "y" && resp != "Y" {
86-
return fmt.Errorf("aborting") //nolint:goerr113
87+
return errors.New("aborting") //nolint:goerr113
8788
}
8889
}
8990
return nil
@@ -168,7 +169,7 @@ func Pull(
168169
return nil, fmt.Errorf("failed to unmarshal config: %w", err)
169170
}
170171

171-
if err := os.MkdirAll(ce.Path.NhostFolder(), 0o755); err != nil { //nolint:gomnd
172+
if err := os.MkdirAll(ce.Path.NhostFolder(), 0o755); err != nil { //nolint:mnd
172173
return nil, fmt.Errorf("failed to create nhost directory: %w", err)
173174
}
174175

Diff for: cmd/config/validate_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,8 @@ func TestValidate(t *testing.T) {
199199
}
200200

201201
for _, tc := range cases {
202-
tc := tc
203202
t.Run(tc.name, func(t *testing.T) {
204203
t.Parallel()
205-
tc := tc
206204

207205
ce := clienv.New(
208206
os.Stdout,

Diff for: cmd/configserver/local.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package configserver
33
import (
44
"context"
55
"encoding/json"
6+
"errors"
67
"fmt"
78
"os"
89

@@ -15,7 +16,7 @@ import (
1516

1617
const zeroUUID = "00000000-0000-0000-0000-000000000000"
1718

18-
var ErrNotImpl = fmt.Errorf("not implemented")
19+
var ErrNotImpl = errors.New("not implemented")
1920

2021
type Local struct {
2122
// we use paths instead of readers/writers because the intention is that these
@@ -132,7 +133,7 @@ func (l *Local) UpdateConfig(_ context.Context, _, newApp *graph.App, _ logrus.F
132133
return fmt.Errorf("failed to marshal app config: %w", err)
133134
}
134135

135-
if err := os.WriteFile(l.config, b, 0o644); err != nil { //nolint:gosec,gomnd
136+
if err := os.WriteFile(l.config, b, 0o644); err != nil { //nolint:gosec,mnd
136137
return fmt.Errorf("failed to write config: %w", err)
137138
}
138139

@@ -154,7 +155,7 @@ func (l *Local) UpdateSecrets(_ context.Context, _, newApp *graph.App, _ logrus.
154155
return fmt.Errorf("failed to marshal app secrets: %w", err)
155156
}
156157

157-
if err := os.WriteFile(l.secrets, b, 0o644); err != nil { //nolint:gosec,gomnd
158+
if err := os.WriteFile(l.secrets, b, 0o644); err != nil { //nolint:gosec,mnd
158159
return fmt.Errorf("failed to write secrets: %w", err)
159160
}
160161

@@ -180,7 +181,7 @@ func (l *Local) UpdateRunServiceConfig(
180181
return fmt.Errorf("failed to marshal run service config: %w", err)
181182
}
182183

183-
if err := os.WriteFile(wr, b, 0o644); err != nil { //nolint:gosec,gomnd
184+
if err := os.WriteFile(wr, b, 0o644); err != nil { //nolint:gosec,mnd
184185
return fmt.Errorf("failed to write run service config: %w", err)
185186
}
186187

Diff for: cmd/configserver/local_test.go

-6
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,8 @@ func TestLocalGetApps(t *testing.T) {
8989
}
9090

9191
for _, tc := range cases {
92-
tc := tc
9392
t.Run(tc.name, func(t *testing.T) {
9493
t.Parallel()
95-
tc := tc
9694

9795
configF, err := os.CreateTemp("", "TestLocalGetApps")
9896
if err != nil {
@@ -153,10 +151,8 @@ func TestLocalUpdateConfig(t *testing.T) { //nolint:dupl
153151
}
154152

155153
for _, tc := range cases {
156-
tc := tc
157154
t.Run(tc.name, func(t *testing.T) {
158155
t.Parallel()
159-
tc := tc
160156

161157
configF, err := os.CreateTemp("", "TestLocalGetApps")
162158
if err != nil {
@@ -225,10 +221,8 @@ func TestLocalUpdateSecrets(t *testing.T) { //nolint:dupl
225221
}
226222

227223
for _, tc := range cases {
228-
tc := tc
229224
t.Run(tc.name, func(t *testing.T) {
230225
t.Parallel()
231-
tc := tc
232226

233227
configF, err := os.CreateTemp("", "TestLocalGetApps")
234228
if err != nil {

Diff for: cmd/dev/up.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package dev
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"os"
78
"os/signal"
@@ -137,12 +138,12 @@ func commandUp(cCtx *cli.Context) error {
137138
// projname to be root directory
138139

139140
if !clienv.PathExists(ce.Path.NhostToml()) {
140-
return fmt.Errorf( //nolint:goerr113
141+
return errors.New( //nolint:goerr113
141142
"no nhost project found, please run `nhost init` or `nhost config pull`",
142143
)
143144
}
144145
if !clienv.PathExists(ce.Path.Secrets()) {
145-
return fmt.Errorf( //nolint:goerr113
146+
return errors.New( //nolint:goerr113
146147
"no secrets found, please run `nhost init` or `nhost config pull`",
147148
)
148149
}
@@ -253,7 +254,7 @@ func parseRunServiceConfigFlag(value string) (string, string, error) {
253254
switch len(parts) {
254255
case 1:
255256
return parts[0], "", nil
256-
case 2: //nolint:gomnd
257+
case 2: //nolint:mnd
257258
return parts[0], parts[1], nil
258259
default:
259260
return "", "", fmt.Errorf( //nolint:goerr113
@@ -325,7 +326,7 @@ func up( //nolint:funlen,cyclop
325326
return fmt.Errorf("failed to validate config: %w", err)
326327
}
327328

328-
ctxWithTimeout, cancel := context.WithTimeout(ctx, 5*time.Second) //nolint:gomnd
329+
ctxWithTimeout, cancel := context.WithTimeout(ctx, 5*time.Second) //nolint:mnd
329330
defer cancel()
330331
ce.Infoln("Checking versions...")
331332
if err := software.CheckVersions(ctxWithTimeout, ce, cfg, appVersion); err != nil {
@@ -402,7 +403,7 @@ func printInfo(
402403
useTLS bool,
403404
runServices []*dockercompose.RunService,
404405
) {
405-
w := tabwriter.NewWriter(os.Stdout, 0, 0, 4, ' ', 0) //nolint:gomnd
406+
w := tabwriter.NewWriter(os.Stdout, 0, 0, 4, ' ', 0) //nolint:mnd
406407
fmt.Fprintf(w, "URLs:\n")
407408
fmt.Fprintf(w,
408409
"- Postgres:\t\tpostgres://postgres:postgres@localhost:%d/local\n",

Diff for: cmd/dockercredentials/configure.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func CommandConfigure() *cli.Command {
3535
Name: flagDockerConfig,
3636
Usage: "Path to docker config file",
3737
EnvVars: []string{"DOCKER_CONFIG"},
38-
Value: fmt.Sprintf("%s/.docker/config.json", home),
38+
Value: home + "/.docker/config.json",
3939
},
4040
&cli.BoolFlag{ //nolint:exhaustruct
4141
Name: flagNoInteractive,
@@ -78,7 +78,7 @@ func writeScript(ctx context.Context, ce *clienv.CliEnv) error {
7878
return fmt.Errorf("could not write to temporary file: %w", err)
7979
}
8080

81-
if err := tmpfile.Chmod(0o755); err != nil { //nolint:gomnd
81+
if err := tmpfile.Chmod(0o755); err != nil { //nolint:mnd
8282
return fmt.Errorf("could not chmod temporary file: %w", err)
8383
}
8484

@@ -95,7 +95,7 @@ func writeScript(ctx context.Context, ce *clienv.CliEnv) error {
9595
}
9696

9797
func configureDocker(dockerConfig string) error {
98-
f, err := os.OpenFile(dockerConfig, os.O_APPEND|os.O_CREATE|os.O_RDWR, 0o644) //nolint:gomnd
98+
f, err := os.OpenFile(dockerConfig, os.O_APPEND|os.O_CREATE|os.O_RDWR, 0o644) //nolint:mnd
9999
if err != nil {
100100
return fmt.Errorf("could not open docker config file: %w", err)
101101
}

0 commit comments

Comments
 (0)