Skip to content

Commit 7452ae7

Browse files
authored
all: group consecutive var declarations (#2869)
Consecutive var declarations are grouped into var blocks, which is more idiomatic in Go. See https://go.dev/doc/effective_go#variables.
1 parent 33b5aa5 commit 7452ae7

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

e2e_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ import (
3838
)
3939

4040
// regexps for parsing commit messages
41-
var nestedCommitRegex = regexp.MustCompile(`(?s)BEGIN_NESTED_COMMIT\n(.*?)\nEND_NESTED_COMMIT`)
42-
var conventionalCommitRegex = regexp.MustCompile(`^(feat|fix|docs|chore): (.+)$`)
41+
var (
42+
nestedCommitRegex = regexp.MustCompile(`(?s)BEGIN_NESTED_COMMIT\n(.*?)\nEND_NESTED_COMMIT`)
43+
conventionalCommitRegex = regexp.MustCompile(`^(feat|fix|docs|chore): (.+)$`)
44+
)
4345

4446
const mockGithubTag = "mock_github"
4547

internal/sidekick/dart/dart.go

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ import (
2626
"github.com/iancoleman/strcase"
2727
)
2828

29-
var typedDataImport = "dart:typed_data"
30-
var httpImport = "package:http/http.dart as http"
31-
var serviceClientImport = "package:google_cloud_rpc/service_client.dart"
32-
var encodingImport = "package:google_cloud_protobuf/src/encoding.dart"
33-
var protobufImport = "package:google_cloud_protobuf/protobuf.dart"
29+
var (
30+
typedDataImport = "dart:typed_data"
31+
httpImport = "package:http/http.dart as http"
32+
serviceClientImport = "package:google_cloud_rpc/service_client.dart"
33+
encodingImport = "package:google_cloud_protobuf/src/encoding.dart"
34+
protobufImport = "package:google_cloud_protobuf/protobuf.dart"
35+
)
3436

3537
var needsCtorValidation = map[string]string{
3638
".google.protobuf.Duration": "",
@@ -57,14 +59,16 @@ var usesCustomEncoding = map[string]string{
5759
".google.protobuf.Value": "",
5860
}
5961

60-
// nestedMessageChar is used to concatenate a message and a child message.
61-
var nestedMessageChar = "_"
62+
var (
63+
// nestedMessageChar is used to concatenate a message and a child message.
64+
nestedMessageChar = "_"
6265

63-
// nestedEnumChar is used to concatenate a message and a child enum.
64-
var nestedEnumChar = "_"
66+
// nestedEnumChar is used to concatenate a message and a child enum.
67+
nestedEnumChar = "_"
6568

66-
// deconflictChar is appended to a name to avoid conflicting with a Dart identifier.
67-
var deconflictChar = "$"
69+
// deconflictChar is appended to a name to avoid conflicting with a Dart identifier.
70+
deconflictChar = "$"
71+
)
6872

6973
// reservedNames is a blocklist of Dart reserved words.
7074
//

system_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ import (
3232
"github.com/googleapis/librarian/internal/images"
3333
)
3434

35-
var testToken = os.Getenv("LIBRARIAN_TEST_GITHUB_TOKEN")
36-
var githubAction = os.Getenv("LIBRARIAN_GITHUB_ACTION")
35+
var (
36+
testToken = os.Getenv("LIBRARIAN_TEST_GITHUB_TOKEN")
37+
githubAction = os.Getenv("LIBRARIAN_GITHUB_ACTION")
38+
)
3739

3840
func TestGetRawContentSystem(t *testing.T) {
3941
if testToken == "" {

0 commit comments

Comments
 (0)