Skip to content

Commit ffd0bf7

Browse files
committed
refactor: standardize context initialization by using short variable declaration for cancel functions
1 parent 38c6808 commit ffd0bf7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/sponge/commands/upgrade.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ func updateSpongeInternalPlugin(targetVersion string) error {
234234
return result.Err
235235
}
236236

237-
ctx, cancel = context.WithTimeout(context.Background(), time.Minute)
237+
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
238238
defer cancel()
239239
genRPCVersion := "github.com/go-dev-frame/sponge/cmd/protoc-gen-go-rpc-tmpl@" + targetVersion
240240
if compareVersion(separatedVersion, targetVersion) {
@@ -250,7 +250,7 @@ func updateSpongeInternalPlugin(targetVersion string) error {
250250

251251
// v1.x.x version does not support protoc-gen-json-field
252252
if !strings.HasPrefix(targetVersion, "v1") {
253-
ctx, cancel = context.WithTimeout(context.Background(), time.Minute) //nolint
253+
ctx, cancel := context.WithTimeout(context.Background(), time.Minute) //nolint
254254
defer cancel()
255255
genJSONVersion := "github.com/go-dev-frame/sponge/cmd/protoc-gen-json-field@" + targetVersion
256256
if compareVersion(separatedVersion, targetVersion) {

0 commit comments

Comments
 (0)