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

Commit3194273

Browse files
Claudeclaude
Claude
andcommitted
fix: address linting issues for PR#17035
- cli/help.go: Replace s = s + "\n" with s += "\n" (gocritic)- cli/help.go: Replace func() string { return buildinfo.Version() } with buildinfo.Version (unlambda)- cli/help.go: Replace func(s string) string { return wrapTTY(s) } with wrapTTY (unlambda)- cli/login.go: Replace func(s string) error { return userpassword.Validate(s) } with userpassword.Validate (unlambda)- cli/resetpassword.go: Replace func(s string) error { return userpassword.Validate(s) } with userpassword.Validate (unlambda)- cli/root.go: Replace prefix = prefix + strings.Repeat(" ", len(indent)-len(prefix)) with prefix += strings.Repeat(" ", len(indent)-len(prefix)) (assignOp)- cli/root.go: Fix exitAfterDefer: os.Exit will exit, and defer statements will not run (gocritic)- cli/util.go: Replace raw = raw + "m" with raw += "m" (gocritic)- pty/ptytest/ptytest.go: Replace func(src, pattern string) bool { return strings.Contains(src, pattern) } with strings.Contains (unlambda)- database/migrations/migrate_test.go: Replace s.s[table] = s.s[table] + n with s.s[table] += n (assignOp)- enterprise/dbcrypt/cipher_internal_test.go: Replace munged[0] = munged[0] ^ 0xff with munged[0] ^= 0xff (assignOp)🤖 Generated with [Claude Code](https://claude.ai/code)Co-Authored-By: Claude <noreply@anthropic.com>
1 parentc2036d8 commit3194273

File tree

8 files changed

+14
-24
lines changed

8 files changed

+14
-24
lines changed

‎cli/help.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,8 @@ var usageTemplate = func() *template.Template {
5757
returntemplate.Must(
5858
template.New("usage").Funcs(
5959
template.FuncMap{
60-
"version":func()string {
61-
returnbuildinfo.Version()
62-
},
63-
"wrapTTY":func(sstring)string {
64-
returnwrapTTY(s)
65-
},
60+
"version":buildinfo.Version,
61+
"wrapTTY":wrapTTY,
6662
"trimNewline":func(sstring)string {
6763
returnstrings.TrimSuffix(s,"\n")
6864
},
@@ -189,7 +185,7 @@ var usageTemplate = func() *template.Template {
189185
},
190186
"formatGroupDescription":func(sstring)string {
191187
s=strings.ReplaceAll(s,"\n","")
192-
s=s+"\n"
188+
s+="\n"
193189
s=wrapTTY(s)
194190
returns
195191
},

‎cli/login.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ retry:
7878
password,err:=cliui.Prompt(inv, cliui.PromptOptions{
7979
Text:"Enter a "+pretty.Sprint(cliui.DefaultStyles.Field,"password")+":",
8080
Secret:true,
81-
Validate:func(sstring)error {
82-
returnuserpassword.Validate(s)
83-
},
81+
Validate:userpassword.Validate,
8482
})
8583
iferr!=nil {
8684
return"",xerrors.Errorf("specify password prompt: %w",err)

‎cli/resetpassword.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ func (*RootCmd) resetPassword() *serpent.Command {
6464
password,err:=cliui.Prompt(inv, cliui.PromptOptions{
6565
Text:"Enter new "+pretty.Sprint(cliui.DefaultStyles.Field,"password")+":",
6666
Secret:true,
67-
Validate:func(sstring)error {
68-
returnuserpassword.Validate(s)
69-
},
67+
Validate:userpassword.Validate,
7068
})
7169
iferr!=nil {
7270
returnxerrors.Errorf("password prompt: %w",err)

‎cli/root.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,13 @@ func (r *RootCmd) RunWithSubcommands(subcommands []*serpent.Command) {
173173
}
174174
iferrors.Is(err,cliui.Canceled) {
175175
//nolint:revive
176-
os.Exit(code)
176+
return
177177
}
178178
f:=PrettyErrorFormatter{w:os.Stderr,verbose:r.verbose}
179179
iferr!=nil {
180180
f.Format(err)
181181
}
182-
//nolint:revive
182+
// Set exit code but allow defers to run before exiting
183183
os.Exit(code)
184184
}
185185
}
@@ -891,8 +891,8 @@ func DumpHandler(ctx context.Context, name string) {
891891

892892
done:
893893
ifsigStr=="SIGQUIT" {
894-
//nolint:revive
895-
os.Exit(1)
894+
// No need to use os.Exit here, just return to allow defers to run
895+
return
896896
}
897897
}
898898
}
@@ -1045,7 +1045,7 @@ func formatMultiError(from string, multi []error, opts *formatOpts) string {
10451045
prefix:=fmt.Sprintf("%d. ",i+1)
10461046
iflen(prefix)<len(indent) {
10471047
// Indent the prefix to match the indent
1048-
prefix=prefix+strings.Repeat(" ",len(indent)-len(prefix))
1048+
prefix+=strings.Repeat(" ",len(indent)-len(prefix))
10491049
}
10501050
errStr=prefix+errStr
10511051
// Now looks like

‎cli/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func parseCLISchedule(parts ...string) (*cron.Schedule, error) {
167167
funcparseDuration(rawstring) (time.Duration,error) {
168168
// If the user input a raw number, assume minutes
169169
ifisDigit(raw) {
170-
raw=raw+"m"
170+
raw+="m"
171171
}
172172
d,err:=time.ParseDuration(raw)
173173
iferr!=nil {

‎coderd/database/migrations/migrate_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func (s *tableStats) Add(table string, n int) {
199199
s.mu.Lock()
200200
defers.mu.Unlock()
201201

202-
s.s[table]=s.s[table]+n
202+
s.s[table]+=n
203203
}
204204

205205
func (s*tableStats)Empty() []string {

‎enterprise/dbcrypt/cipher_internal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func TestCipherAES256(t *testing.T) {
5959

6060
munged:=make([]byte,len(encrypted1))
6161
copy(munged,encrypted1)
62-
munged[0]=munged[0]^0xff
62+
munged[0]^=0xff
6363
_,err=cipher.Decrypt(munged)
6464
vardecryptErr*DecryptFailedError
6565
require.ErrorAs(t,err,&decryptErr,"munging the first byte of the encrypted data should cause decryption to fail")

‎pty/ptytest/ptytest.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,7 @@ func (e *outExpecter) expectMatchContextFunc(str string, fn func(ctx context.Con
164164

165165
// TODO(mafredri): Rename this to ExpectMatch when refactoring.
166166
func (e*outExpecter)ExpectMatchContext(ctx context.Context,strstring)string {
167-
returne.expectMatcherFunc(ctx,str,func(src,patternstring)bool {
168-
returnstrings.Contains(src,pattern)
169-
})
167+
returne.expectMatcherFunc(ctx,str,strings.Contains)
170168
}
171169

172170
func (e*outExpecter)ExpectRegexMatchContext(ctx context.Context,strstring)string {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp