Skip to content

Commit

Permalink
style: format files with gofmt
Browse files Browse the repository at this point in the history
  • Loading branch information
wyardley committed Oct 17, 2024
1 parent c3f5e92 commit 526bdcb
Show file tree
Hide file tree
Showing 16 changed files with 39 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .ci/magician/cmd/scheduled_pr_reminders_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ func TestFormatReminderComment(t *testing.T) {
&github.User{Login: github.String("other-reviewer")},
},
},
state: waitingForMerge,
state: waitingForMerge,
sinceDays: 5,
expectedStrings: []string{
"waiting for merge for 1 week",
Expand Down
12 changes: 6 additions & 6 deletions .ci/magician/cmd/templates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ func TestColor(t *testing.T) {
want: "🟡 Test text",
},
{
name: "green",
name: "green",
color: "green",
text: "Test text",
want: "🟢 Test text",
text: "Test text",
want: "🟢 Test text",
},
{
name: "unsupported color",
name: "unsupported color",
color: "mauve",
text: "Test text",
want: "Test text",
text: "Test text",
want: "Test text",
},
{
name: "empty color",
Expand Down
4 changes: 2 additions & 2 deletions .ci/magician/cmd/test_terraform_vcr.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,8 @@ func init() {

func formatComment(fileName string, tmplText string, data any) (string, error) {
funcs := template.FuncMap{
"join": strings.Join,
"add": func(i, j int) int { return i + j },
"join": strings.Join,
"add": func(i, j int) int { return i + j },
"color": color,
}
tmpl, err := template.New(fileName).Funcs(funcs).Parse(tmplText)
Expand Down
8 changes: 4 additions & 4 deletions .ci/magician/cmd/test_terraform_vcr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,8 @@ func TestWithReplayFailedTests(t *testing.T) {

func TestWithoutReplayFailedTests(t *testing.T) {
tests := []struct {
name string
data withoutReplayFailedTests
name string
data withoutReplayFailedTests
wantContains []string
}{
{
Expand Down Expand Up @@ -512,8 +512,8 @@ func TestWithoutReplayFailedTests(t *testing.T) {

func TestRecordReplay(t *testing.T) {
tests := []struct {
name string
data recordReplay
name string
data recordReplay
wantContains []string
}{
{
Expand Down
2 changes: 1 addition & 1 deletion .ci/magician/cmd/test_tgc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestExecTestTGC(t *testing.T) {
execTestTGC("sha1", "pr1", gh)

method := "CreateWorkflowDispatchEvent"
expected := [][]any{{"test-tgc.yml", map[string]any{"tpgb-branch": "auto-pr-pr1", "tgc-branch": "auto-pr-pr1", "pr-number":"pr1", "owner": "modular-magician", "repo": "terraform-google-conversion", "sha": "sha1"}}}
expected := [][]any{{"test-tgc.yml", map[string]any{"tpgb-branch": "auto-pr-pr1", "tgc-branch": "auto-pr-pr1", "pr-number": "pr1", "owner": "modular-magician", "repo": "terraform-google-conversion", "sha": "sha1"}}}
if calls, ok := gh.calledMethods[method]; !ok {
t.Fatal("Workflow dispatch event not created")
} else if !reflect.DeepEqual(calls, expected) {
Expand Down
4 changes: 2 additions & 2 deletions .ci/magician/cmd/test_tpg.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ package cmd

import (
"fmt"
"github.com/spf13/cobra"
"magician/github"
"os"
"github.com/spf13/cobra"
)

type ttGithub interface {
Expand Down Expand Up @@ -73,7 +73,7 @@ func execTestTPG(version, commit, pr string, gh ttGithub) error {

commitShaOrBranchUpstream := string(content)

if commitShaOrBranchUpstream == ""{
if commitShaOrBranchUpstream == "" {
// fall back to branch if commit SHA can't be found
commitShaOrBranchUpstream = "auto-pr-" + pr
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ func testAccCheckGoogleSqlDatabaseExists(t *testing.T, n string, database *sqlad

*database = *found

return nil
}
}
return nil
}
}

func testAccSqlDatabaseDestroyProducer(t *testing.T) func(s *terraform.State) error {
return func(s *terraform.State) error {
Expand Down Expand Up @@ -197,7 +197,7 @@ func TestAccSqlDatabase_instanceWithActivationPolicy(t *testing.T) {
CheckDestroy: testAccSqlDatabaseDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testGoogleSqlDatabase_instanceWithActivationPolicy(instance_name, database_name , "ALWAYS"),
Config: testGoogleSqlDatabase_instanceWithActivationPolicy(instance_name, database_name, "ALWAYS"),
Check: resource.ComposeTestCheckFunc(
testAccCheckGoogleSqlDatabaseExists(
t, "google_sql_database.database", &database),
Expand Down Expand Up @@ -241,10 +241,9 @@ resource "google_sql_database" "database" {
name = "%s"
instance = google_sql_database_instance.instance.name
}
`, instance_name, activationPolicy, database_name,)
`, instance_name, activationPolicy, database_name)
}


var testGoogleSqlDatabase_basic = `
resource "google_sql_database_instance" "instance" {
name = "%s"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// structure for rules regarding resource config changes
type ResourceConfigDiffRule struct {
Identifier string
Messages func(resource string, resourceConfigDiff diff.ResourceConfigDiff) []string
Messages func(resource string, resourceConfigDiff diff.ResourceConfigDiff) []string
}

// ResourceConfigDiffRules is a list of ResourceConfigDiffRule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ var resourceConfigRemovingAResourceTestCases = []resourceInventoryTestCase{
new: nil,
wantViolations: true,
},
}
}
2 changes: 1 addition & 1 deletion tools/diff-processor/cmd/breaking_changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"os"
"sort"

"github.com/GoogleCloudPlatform/magic-modules/tools/diff-processor/diff"
"github.com/GoogleCloudPlatform/magic-modules/tools/diff-processor/breaking_changes"
"github.com/GoogleCloudPlatform/magic-modules/tools/diff-processor/diff"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion tools/diff-processor/cmd/breaking_changes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"encoding/json"
"testing"

"github.com/GoogleCloudPlatform/magic-modules/tools/diff-processor/diff"
"github.com/GoogleCloudPlatform/magic-modules/tools/diff-processor/breaking_changes"
"github.com/GoogleCloudPlatform/magic-modules/tools/diff-processor/diff"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand Down
6 changes: 3 additions & 3 deletions tpgtools/property_helpers.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2021 Google LLC. All Rights Reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down
6 changes: 3 additions & 3 deletions tpgtools/serializable/serializable.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2021 Google LLC. All Rights Reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down
8 changes: 4 additions & 4 deletions tpgtools/serializable/serializable_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2021 Google LLC. All Rights Reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -18,7 +18,7 @@ import (
"testing"
)

func TestListOfResources(t *testing.T) {
func TestListOfResources(t *testing.T) {
services, err := ListOfResources("test_specs")
if err != nil {
t.Errorf("received error: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion tpgtools/serialization_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"strings"

cloudresourcemanager "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/cloudresourcemanager"
cloudresourcemanagerBeta "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/cloudresourcemanager/beta"
cloudresourcemanagerAlpha "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/cloudresourcemanager/alpha"
cloudresourcemanagerBeta "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/cloudresourcemanager/beta"
)

func serializeAlphaProjectToHCL(r cloudresourcemanagerAlpha.Project, hasGAEquivalent bool) (string, error) {
Expand Down
6 changes: 3 additions & 3 deletions tpgtools/type.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2021 Google LLC. All Rights Reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down

0 comments on commit 526bdcb

Please sign in to comment.