Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Commitd664df2

Browse files
committed
Remove "failed to" from errs
1 parent5f7d205 commitd664df2

File tree

9 files changed

+31
-31
lines changed

9 files changed

+31
-31
lines changed

‎ci/integration/setup_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func build(path string) error {
3939

4040
out,err:=cmd.CombinedOutput()
4141
iferr!=nil {
42-
returnxerrors.Errorf("failed tobuild coder-cli (%v): %w",string(out),err)
42+
returnxerrors.Errorf("build coder-cli (%v): %w",string(out),err)
4343
}
4444
returnnil
4545
}

‎ci/tcli/tcli.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func NewContainerRunner(ctx context.Context, config *ContainerConfig) (*Containe
7676
out,err:=cmd.CombinedOutput()
7777
iferr!=nil {
7878
returnnil,xerrors.Errorf(
79-
"failed tostart testing container %q, (%s): %w",
79+
"start testing container %q, (%s): %w",
8080
config.Name,string(out),err)
8181
}
8282

@@ -97,7 +97,7 @@ func (r *ContainerRunner) Close() error {
9797
out,err:=cmd.CombinedOutput()
9898
iferr!=nil {
9999
returnxerrors.Errorf(
100-
"failed tostop testing container %q, (%s): %w",
100+
"stop testing container %q, (%s): %w",
101101
r.name,string(out),err)
102102
}
103103
returnnil
@@ -290,7 +290,7 @@ func matches(t *testing.T, name, pattern string, target []byte) {
290290

291291
ok,err:=regexp.Match(pattern,target)
292292
iferr!=nil {
293-
slogtest.Fatal(t,"failed toattempt regexp match",append(fields,slog.Error(err))...)
293+
slogtest.Fatal(t,"attempt regexp match",append(fields,slog.Error(err))...)
294294
}
295295
if!ok {
296296
slogtest.Fatal(t,"expected to find pattern, no match found",fields...)

‎cmd/coder/ceapi.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func getEnvs(client *entclient.Client) ([]entclient.Environment, error) {
5959
funcfindEnv(client*entclient.Client,namestring) (*entclient.Environment,error) {
6060
envs,err:=getEnvs(client)
6161
iferr!=nil {
62-
returnnil,xerrors.Errorf("failed toget environments: %w",err)
62+
returnnil,xerrors.Errorf("get environments: %w",err)
6363
}
6464

6565
varfound []string

‎cmd/coder/configssh.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func configSSH(filepath *string, remove *bool) func(c *cli.Context) error {
6666
// SSH configs are not always already there.
6767
currentConfig=""
6868
}elseiferr!=nil {
69-
returnxerrors.Errorf("failed toread ssh config file %q: %w",filepath,err)
69+
returnxerrors.Errorf("read ssh config file %q: %w",filepath,err)
7070
}
7171

7272
startIndex:=strings.Index(currentConfig,startToken)
@@ -80,7 +80,7 @@ func configSSH(filepath *string, remove *bool) func(c *cli.Context) error {
8080

8181
err=writeStr(*filepath,currentConfig)
8282
iferr!=nil {
83-
returnxerrors.Errorf("failed towrite to ssh config file %q: %v",*filepath,err)
83+
returnxerrors.Errorf("write to ssh config file %q: %v",*filepath,err)
8484
}
8585

8686
returnnil
@@ -95,7 +95,7 @@ func configSSH(filepath *string, remove *bool) func(c *cli.Context) error {
9595

9696
me,err:=entClient.Me()
9797
iferr!=nil {
98-
returnxerrors.Errorf("failed tofetch username: %w",err)
98+
returnxerrors.Errorf("fetch username: %w",err)
9999
}
100100

101101
envs,err:=getEnvs(entClient)
@@ -107,7 +107,7 @@ func configSSH(filepath *string, remove *bool) func(c *cli.Context) error {
107107
}
108108
newConfig,err:=makeNewConfigs(me.Username,envs,startToken,startMessage,endToken)
109109
iferr!=nil {
110-
returnxerrors.Errorf("failed tomake new ssh configurations: %w",err)
110+
returnxerrors.Errorf("make new ssh configurations: %w",err)
111111
}
112112

113113
// if we find the old config, remove those chars from the string
@@ -117,11 +117,11 @@ func configSSH(filepath *string, remove *bool) func(c *cli.Context) error {
117117

118118
err=writeStr(*filepath,currentConfig+newConfig)
119119
iferr!=nil {
120-
returnxerrors.Errorf("failed towrite new configurations to ssh config file %q: %w",filepath,err)
120+
returnxerrors.Errorf("write new configurations to ssh config file %q: %w",filepath,err)
121121
}
122122
err=writeSSHKey(ctx,entClient)
123123
iferr!=nil {
124-
returnxerrors.Errorf("failed tofetch and write ssh key: %w",err)
124+
returnxerrors.Errorf("fetch and write ssh key: %w",err)
125125
}
126126

127127
fmt.Printf("An auto-generated ssh config was written to %q\n",*filepath)

‎cmd/coder/envs.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func makeEnvsCommand() cli.Command {
2121
Name:"ls",
2222
Usage:"list all environments owned by the active user",
2323
Description:"List all Coder environments owned by the active user.",
24-
ArgsUsage:"[...flags]>",
24+
ArgsUsage:"[...flags]",
2525
Action:func(c*cli.Context)error {
2626
entClient:=requireAuth()
2727
envs,err:=getEnvs(entClient)
@@ -35,12 +35,12 @@ func makeEnvsCommand() cli.Command {
3535
returnenvs[i]
3636
})
3737
iferr!=nil {
38-
returnxerrors.Errorf("failed towrite table: %w",err)
38+
returnxerrors.Errorf("write table: %w",err)
3939
}
4040
case"json":
4141
err:=json.NewEncoder(os.Stdout).Encode(envs)
4242
iferr!=nil {
43-
returnxerrors.Errorf("failed towrite environments as JSON: %w",err)
43+
returnxerrors.Errorf("write environments as JSON: %w",err)
4444
}
4545
default:
4646
returnxerrors.Errorf("unknown --output value %q",outputFmt)

‎cmd/coder/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func main() {
2727

2828
stdoutState,err:=xterminal.MakeOutputRaw(os.Stdout.Fd())
2929
iferr!=nil {
30-
flog.Fatal("failed toset output to raw: %v",err)
30+
flog.Fatal("set output to raw: %v",err)
3131
}
3232
deferxterminal.Restore(os.Stdout.Fd(),stdoutState)
3333

‎cmd/coder/secrets.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func makeCreateSecret() cli.Command {
8383
}elseiffromFile!="" {
8484
contents,err:=ioutil.ReadFile(fromFile)
8585
iferr!=nil {
86-
returnxerrors.Errorf("failed toread file: %w",err)
86+
returnxerrors.Errorf("read file: %w",err)
8787
}
8888
value=string(contents)
8989
}else {
@@ -99,7 +99,7 @@ func makeCreateSecret() cli.Command {
9999
}
100100
value,err=prompt.Run()
101101
iferr!=nil {
102-
returnxerrors.Errorf("failed toprompt for value: %w",err)
102+
returnxerrors.Errorf("prompt for value: %w",err)
103103
}
104104
}
105105

@@ -109,7 +109,7 @@ func makeCreateSecret() cli.Command {
109109
Description:description,
110110
})
111111
iferr!=nil {
112-
returnxerrors.Errorf("failed toinsert secret: %w",err)
112+
returnxerrors.Errorf("insert secret: %w",err)
113113
}
114114
returnnil
115115
},
@@ -144,7 +144,7 @@ func listSecrets(_ *cli.Context) error {
144144

145145
secrets,err:=client.Secrets()
146146
iferr!=nil {
147-
returnxerrors.Errorf("failed toget secrets: %w",err)
147+
returnxerrors.Errorf("get secrets: %w",err)
148148
}
149149

150150
iflen(secrets)<1 {
@@ -158,7 +158,7 @@ func listSecrets(_ *cli.Context) error {
158158
returns
159159
})
160160
iferr!=nil {
161-
returnxerrors.Errorf("failed towrite table of secrets: %w",err)
161+
returnxerrors.Errorf("write table of secrets: %w",err)
162162
}
163163
returnnil
164164
}
@@ -174,12 +174,12 @@ func viewSecret(c *cli.Context) error {
174174

175175
secret,err:=client.SecretByName(name)
176176
iferr!=nil {
177-
returnxerrors.Errorf("failed toget secret by name: %w",err)
177+
returnxerrors.Errorf("get secret by name: %w",err)
178178
}
179179

180180
_,err=fmt.Fprintln(os.Stdout,secret.Value)
181181
iferr!=nil {
182-
returnxerrors.Errorf("failed to write: %w",err)
182+
returnxerrors.Errorf("write secret value: %w",err)
183183
}
184184
returnnil
185185
}

‎cmd/coder/urls.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@ func makeListDevURLs(outputFmt *string) func(c *cli.Context) error {
123123
returndevURLs[i]
124124
})
125125
iferr!=nil {
126-
returnxerrors.Errorf("failed towrite table: %w",err)
126+
returnxerrors.Errorf("write table: %w",err)
127127
}
128128
case"json":
129129
err:=json.NewEncoder(os.Stdout).Encode(devURLs)
130130
iferr!=nil {
131-
returnxerrors.Errorf("failed toencode DevURLsto json: %w",err)
131+
returnxerrors.Errorf("encode DevURLsas json: %w",err)
132132
}
133133
default:
134134
returnxerrors.Errorf("unknown --output value %q",*outputFmt)
@@ -208,13 +208,13 @@ func makeCreateDevURL() cli.Command {
208208
flog.Info("Updating devurl for port %v",port)
209209
err:=entClient.UpdateDevURL(env.ID,urlID,portNum,urlname,access)
210210
iferr!=nil {
211-
returnxerrors.Errorf("failed toupdate DevURL: %w",err)
211+
returnxerrors.Errorf("update DevURL: %w",err)
212212
}
213213
}else {
214214
flog.Info("Adding devurl for port %v",port)
215215
err:=entClient.InsertDevURL(env.ID,portNum,urlname,access)
216216
iferr!=nil {
217-
returnxerrors.Errorf("failed toinsert DevURL: %w",err)
217+
returnxerrors.Errorf("insert DevURL: %w",err)
218218
}
219219
}
220220
returnnil
@@ -248,7 +248,7 @@ func removeDevURL(c *cli.Context) error {
248248

249249
portNum,err:=validatePort(port)
250250
iferr!=nil {
251-
returnxerrors.Errorf("failed tovalidate port: %w",err)
251+
returnxerrors.Errorf("validate port: %w",err)
252252
}
253253

254254
entClient:=requireAuth()
@@ -271,7 +271,7 @@ func removeDevURL(c *cli.Context) error {
271271

272272
err=entClient.DelDevURL(env.ID,urlID)
273273
iferr!=nil {
274-
returnxerrors.Errorf("failed todelete DevURL: %w",err)
274+
returnxerrors.Errorf("delete DevURL: %w",err)
275275
}
276276
returnnil
277277
}

‎cmd/coder/users.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func listUsers(outputFmt *string) func(c *cli.Context) error {
3939

4040
users,err:=entClient.Users()
4141
iferr!=nil {
42-
returnxerrors.Errorf("failed toget users: %w",err)
42+
returnxerrors.Errorf("get users: %w",err)
4343
}
4444

4545
switch*outputFmt {
@@ -48,12 +48,12 @@ func listUsers(outputFmt *string) func(c *cli.Context) error {
4848
returnusers[i]
4949
})
5050
iferr!=nil {
51-
returnxerrors.Errorf("failed towrite table: %w",err)
51+
returnxerrors.Errorf("write table: %w",err)
5252
}
5353
case"json":
5454
err=json.NewEncoder(os.Stdout).Encode(users)
5555
iferr!=nil {
56-
returnxerrors.Errorf("failed toencode usersto json: %w",err)
56+
returnxerrors.Errorf("encode usersas json: %w",err)
5757
}
5858
default:
5959
returnxerrors.New("unknown value for --output")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp