Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
upodroid committed Jan 8, 2024
1 parent 57b9805 commit bc4f045
Show file tree
Hide file tree
Showing 23 changed files with 56 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,6 @@ resource "google_compute_region_health_check" "api-minimal-gce-example-com" {
}
name = "api-minimal-gce-example-com"
region = "us-test1"
tcp_health_check {
port = 0
}
}

resource "google_compute_router" "nat-minimal-gce-example-com" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,9 +581,6 @@ resource "google_compute_region_health_check" "api-minimal-gce-ilb-example-com"
}
name = "api-minimal-gce-ilb-example-com"
region = "us-test1"
tcp_health_check {
port = 0
}
}

resource "google_compute_router" "nat-minimal-gce-ilb-example-com" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,9 +581,6 @@ resource "google_compute_region_health_check" "api-minimal-gce-with-a-very-very-
}
name = "api-minimal-gce-with-a-very-very-very-very-very-long-name-example-com"
region = "us-test1"
tcp_health_check {
port = 0
}
}

resource "google_compute_router" "nat-minimal-gce-with-a-very-very-very-very-very-long-nam-96dqvi" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,6 @@ resource "google_compute_health_check" "api-minimal-gce-plb-example-com" {
}
name = "api-minimal-gce-plb-example-com"
region = ""
tcp_health_check {
port = 0
}
}

resource "google_compute_instance_group_manager" "a-master-us-test1-a-minimal-gce-plb-example-com" {
Expand Down
2 changes: 1 addition & 1 deletion upup/pkg/fi/cloudup/gcetasks/accelerator_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (a *AcceleratorConfig) GetDependencies(tasks map[string]fi.CloudupTask) []f
return nil
}

func (_ *AcceleratorConfig) ShouldCreate(a, e, changes *AcceleratorConfig) (bool, error) {
func (*AcceleratorConfig) ShouldCreate(a, e, changes *AcceleratorConfig) (bool, error) {
if e.AcceleratorCount < 0 {
return false, fmt.Errorf("acceleratorCount must be positive or 0")
}
Expand Down
6 changes: 3 additions & 3 deletions upup/pkg/fi/cloudup/gcetasks/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (e *Address) Run(c *fi.CloudupContext) error {
return fi.CloudupDefaultDeltaRunMethod(e, c)
}

func (_ *Address) CheckChanges(a, e, changes *Address) error {
func (*Address) CheckChanges(a, e, changes *Address) error {
if a != nil {
if changes.Name != nil {
return fi.CannotChangeField("Name")
Expand All @@ -141,7 +141,7 @@ func (_ *Address) CheckChanges(a, e, changes *Address) error {
return nil
}

func (_ *Address) RenderGCE(t *gce.GCEAPITarget, a, e, changes *Address) error {
func (*Address) RenderGCE(t *gce.GCEAPITarget, a, e, changes *Address) error {
cloud := t.Cloud
addr := &compute.Address{
Name: *e.Name,
Expand Down Expand Up @@ -180,7 +180,7 @@ type terraformAddress struct {
Subnetwork *terraformWriter.Literal `cty:"subnetwork"`
}

func (_ *Address) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *Address) error {
func (*Address) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *Address) error {
tf := &terraformAddress{
Name: e.Name,
AddressType: e.IPAddressType,
Expand Down
6 changes: 3 additions & 3 deletions upup/pkg/fi/cloudup/gcetasks/backend_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (e *BackendService) Run(c *fi.CloudupContext) error {
return fi.CloudupDefaultDeltaRunMethod(e, c)
}

func (_ *BackendService) CheckChanges(a, e, changes *BackendService) error {
func (*BackendService) CheckChanges(a, e, changes *BackendService) error {
if a != nil {
if changes.Name != nil {
return fi.CannotChangeField("Name")
Expand All @@ -104,7 +104,7 @@ func (_ *BackendService) CheckChanges(a, e, changes *BackendService) error {
return nil
}

func (_ *BackendService) RenderGCE(t *gce.GCEAPITarget, a, e, changes *BackendService) error {
func (*BackendService) RenderGCE(t *gce.GCEAPITarget, a, e, changes *BackendService) error {
cloud := t.Cloud
var hcs []string
for _, hc := range e.HealthChecks {
Expand Down Expand Up @@ -167,7 +167,7 @@ type terraformBackendService struct {
Backend []terraformBackend `cty:"backend"`
}

func (_ *BackendService) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *BackendService) error {
func (*BackendService) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *BackendService) error {
tf := &terraformBackendService{
Name: e.Name,
LoadBalancingScheme: e.LoadBalancingScheme,
Expand Down
6 changes: 3 additions & 3 deletions upup/pkg/fi/cloudup/gcetasks/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (e *Disk) Run(c *fi.CloudupContext) error {
return fi.CloudupDefaultDeltaRunMethod(e, c)
}

func (_ *Disk) CheckChanges(a, e, changes *Disk) error {
func (*Disk) CheckChanges(a, e, changes *Disk) error {
if a != nil {
if changes.SizeGB != nil {
return fi.CannotChangeField("SizeGB")
Expand All @@ -103,7 +103,7 @@ func (_ *Disk) CheckChanges(a, e, changes *Disk) error {
return nil
}

func (_ *Disk) RenderGCE(t *gce.GCEAPITarget, a, e, changes *Disk) error {
func (*Disk) RenderGCE(t *gce.GCEAPITarget, a, e, changes *Disk) error {
cloud := t.Cloud
typeURL := fmt.Sprintf("https://www.googleapis.com/compute/v1/projects/%s/zones/%s/diskTypes/%s",
cloud.Project(),
Expand Down Expand Up @@ -170,7 +170,7 @@ type terraformDisk struct {
Labels map[string]string `cty:"labels"`
}

func (_ *Disk) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *Disk) error {
func (*Disk) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *Disk) error {
cloud := t.Cloud.(gce.GCECloud)

labels := make(map[string]string)
Expand Down
6 changes: 3 additions & 3 deletions upup/pkg/fi/cloudup/gcetasks/firewallrule.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (e *FirewallRule) Normalize(c *fi.CloudupContext) error {
return nil
}

func (_ *FirewallRule) CheckChanges(a, e, changes *FirewallRule) error {
func (*FirewallRule) CheckChanges(a, e, changes *FirewallRule) error {
if e.Network == nil {
return fi.RequiredField("Network")
}
Expand Down Expand Up @@ -202,7 +202,7 @@ func (e *FirewallRule) mapToGCE(project string) (*compute.Firewall, error) {
return firewall, nil
}

func (_ *FirewallRule) RenderGCE(t *gce.GCEAPITarget, a, e, changes *FirewallRule) error {
func (*FirewallRule) RenderGCE(t *gce.GCEAPITarget, a, e, changes *FirewallRule) error {
cloud := t.Cloud
firewall, err := e.mapToGCE(cloud.Project())
if err != nil {
Expand Down Expand Up @@ -243,7 +243,7 @@ type terraformFirewall struct {
Disabled bool `cty:"disabled"`
}

func (_ *FirewallRule) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *FirewallRule) error {
func (*FirewallRule) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *FirewallRule) error {
g, err := e.mapToGCE(t.Project)
if err != nil {
return err
Expand Down
6 changes: 3 additions & 3 deletions upup/pkg/fi/cloudup/gcetasks/forwardingrule.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ func (e *ForwardingRule) Run(c *fi.CloudupContext) error {
return fi.CloudupDefaultDeltaRunMethod(e, c)
}

func (_ *ForwardingRule) CheckChanges(a, e, changes *ForwardingRule) error {
func (*ForwardingRule) CheckChanges(a, e, changes *ForwardingRule) error {
if fi.ValueOf(e.Name) == "" {
return fi.RequiredField("Name")
}
return nil
}

func (_ *ForwardingRule) RenderGCE(t *gce.GCEAPITarget, a, e, changes *ForwardingRule) error {
func (*ForwardingRule) RenderGCE(t *gce.GCEAPITarget, a, e, changes *ForwardingRule) error {
ctx := context.TODO()

name := fi.ValueOf(e.Name)
Expand Down Expand Up @@ -283,7 +283,7 @@ type terraformForwardingRule struct {
Labels map[string]string `cty:"labels"`
}

func (_ *ForwardingRule) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *ForwardingRule) error {
func (*ForwardingRule) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *ForwardingRule) error {
name := fi.ValueOf(e.Name)

tf := &terraformForwardingRule{
Expand Down
4 changes: 2 additions & 2 deletions upup/pkg/fi/cloudup/gcetasks/httphealthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (e *HTTPHealthcheck) Run(c *fi.CloudupContext) error {
return fi.CloudupDefaultDeltaRunMethod(e, c)
}

func (_ *HTTPHealthcheck) CheckChanges(a, e, changes *HTTPHealthcheck) error {
func (*HTTPHealthcheck) CheckChanges(a, e, changes *HTTPHealthcheck) error {
if fi.ValueOf(e.Name) == "" {
return fi.RequiredField("Name")
}
Expand Down Expand Up @@ -104,7 +104,7 @@ type terraformHTTPHealthcheck struct {
RequestPath *string `cty:"request_path"`
}

func (_ *HTTPHealthcheck) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *HTTPHealthcheck) error {
func (*HTTPHealthcheck) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *HTTPHealthcheck) error {
tf := &terraformHTTPHealthcheck{
Name: *e.Name,
Port: e.Port,
Expand Down
6 changes: 3 additions & 3 deletions upup/pkg/fi/cloudup/gcetasks/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (e *Instance) Run(c *fi.CloudupContext) error {
return fi.CloudupDefaultDeltaRunMethod(e, c)
}

func (_ *Instance) CheckChanges(a, e, changes *Instance) error {
func (*Instance) CheckChanges(a, e, changes *Instance) error {
return nil
}

Expand Down Expand Up @@ -319,7 +319,7 @@ func (i *Instance) isZero() bool {
return reflect.DeepEqual(zero, i)
}

func (_ *Instance) RenderGCE(t *gce.GCEAPITarget, a, e, changes *Instance) error {
func (*Instance) RenderGCE(t *gce.GCEAPITarget, a, e, changes *Instance) error {
cloud := t.Cloud
project := cloud.Project()
zone := *e.Zone
Expand Down Expand Up @@ -426,7 +426,7 @@ type terraformInstanceAttachedDisk struct {
Size int64 `cty:"size"`
}

func (_ *Instance) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *Instance) error {
func (*Instance) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *Instance) error {
project := t.Project

// This is a "little" hacky...
Expand Down
6 changes: 3 additions & 3 deletions upup/pkg/fi/cloudup/gcetasks/instancegroupmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ func (e *InstanceGroupManager) Run(c *fi.CloudupContext) error {
return fi.CloudupDefaultDeltaRunMethod(e, c)
}

func (_ *InstanceGroupManager) CheckChanges(a, e, changes *InstanceGroupManager) error {
func (*InstanceGroupManager) CheckChanges(a, e, changes *InstanceGroupManager) error {
return nil
}

func (_ *InstanceGroupManager) RenderGCE(t *gce.GCEAPITarget, a, e, changes *InstanceGroupManager) error {
func (*InstanceGroupManager) RenderGCE(t *gce.GCEAPITarget, a, e, changes *InstanceGroupManager) error {
project := t.Cloud.Project()

instanceTemplateURL, err := e.InstanceTemplate.URL(project)
Expand Down Expand Up @@ -188,7 +188,7 @@ type terraformVersion struct {
InstanceTemplate *terraformWriter.Literal `cty:"instance_template"`
}

func (_ *InstanceGroupManager) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *InstanceGroupManager) error {
func (*InstanceGroupManager) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *InstanceGroupManager) error {
tf := &terraformInstanceGroupManager{
Name: e.Name,
Zone: e.Zone,
Expand Down
8 changes: 4 additions & 4 deletions upup/pkg/fi/cloudup/gcetasks/instancetemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func (e *InstanceTemplate) Run(c *fi.CloudupContext) error {
return fi.CloudupDefaultDeltaRunMethod(e, c)
}

func (_ *InstanceTemplate) CheckChanges(a, e, changes *InstanceTemplate) error {
func (*InstanceTemplate) CheckChanges(a, e, changes *InstanceTemplate) error {
if fi.ValueOf(e.BootDiskImage) == "" {
return fi.RequiredField("BootDiskImage")
}
Expand Down Expand Up @@ -457,7 +457,7 @@ func (e *InstanceTemplate) URL(project string) (string, error) {
return fmt.Sprintf("https://www.googleapis.com/compute/v1/projects/%s/global/instanceTemplates/%s", project, *e.ID), nil
}

func (_ *InstanceTemplate) RenderGCE(t *gce.GCEAPITarget, a, e, changes *InstanceTemplate) error {
func (*InstanceTemplate) RenderGCE(t *gce.GCEAPITarget, a, e, changes *InstanceTemplate) error {
project := t.Cloud.Project()
region := t.Cloud.Region()

Expand All @@ -482,7 +482,7 @@ func (_ *InstanceTemplate) RenderGCE(t *gce.GCEAPITarget, a, e, changes *Instanc
return fmt.Errorf("error creating InstanceTemplate: %v", err)
}
} else {
return fmt.Errorf("Cannot apply changes to InstanceTemplate: %v", changes)
return fmt.Errorf("cannot apply changes to InstanceTemplate: %v", changes)
}

return nil
Expand Down Expand Up @@ -613,7 +613,7 @@ func mapServiceAccountsToTerraform(serviceAccounts []*ServiceAccount, saScopes [
return out
}

func (_ *InstanceTemplate) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *InstanceTemplate) error {
func (*InstanceTemplate) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *InstanceTemplate) error {
project := t.Project

i, err := e.mapToGCE(project, t.Cloud.Region())
Expand Down
8 changes: 4 additions & 4 deletions upup/pkg/fi/cloudup/gcetasks/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (e *Network) Run(c *fi.CloudupContext) error {
return fi.CloudupDefaultDeltaRunMethod(e, c)
}

func (_ *Network) CheckChanges(a, e, changes *Network) error {
func (*Network) CheckChanges(a, e, changes *Network) error {
cidr := fi.ValueOf(e.CIDR)
switch e.Mode {
case "legacy":
Expand Down Expand Up @@ -137,7 +137,7 @@ func (_ *Network) CheckChanges(a, e, changes *Network) error {
return nil
}

func (_ *Network) RenderGCE(t *gce.GCEAPITarget, a, e, changes *Network) error {
func (*Network) RenderGCE(t *gce.GCEAPITarget, a, e, changes *Network) error {
shared := fi.ValueOf(e.Shared)
if shared {
// Verify the network was found
Expand Down Expand Up @@ -181,7 +181,7 @@ func (_ *Network) RenderGCE(t *gce.GCEAPITarget, a, e, changes *Network) error {
}
} else {
if a.Mode == "legacy" {
return fmt.Errorf("GCE networks in legacy mode are not supported. Please convert to auto mode or specify a different network.")
return fmt.Errorf("networks in legacy mode are not supported. Please convert to auto mode or specify a different network")
}
empty := &Network{}
if !reflect.DeepEqual(empty, changes) {
Expand All @@ -199,7 +199,7 @@ type terraformNetwork struct {
AutoCreateSubnetworks *bool `cty:"auto_create_subnetworks"`
}

func (_ *Network) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *Network) error {
func (*Network) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *Network) error {
shared := fi.ValueOf(e.Shared)
if shared {
// Not terraform owned / managed
Expand Down
6 changes: 3 additions & 3 deletions upup/pkg/fi/cloudup/gcetasks/poolhealthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type PoolHealthCheck struct {
var _ fi.CompareWithID = &PoolHealthCheck{}

// GetDependencies returns the dependencies of the PoolHealthCheck task
func (_ *PoolHealthCheck) GetDependencies(tasks map[string]fi.CloudupTask) []fi.CloudupTask {
func (*PoolHealthCheck) GetDependencies(tasks map[string]fi.CloudupTask) []fi.CloudupTask {
var deps []fi.CloudupTask
for _, task := range tasks {
if _, ok := task.(*HTTPHealthcheck); ok {
Expand Down Expand Up @@ -81,7 +81,7 @@ func (e *PoolHealthCheck) Run(c *fi.CloudupContext) error {
return fi.CloudupDefaultDeltaRunMethod(e, c)
}

func (_ *PoolHealthCheck) CheckChanges(a, e, changes *PoolHealthCheck) error {
func (*PoolHealthCheck) CheckChanges(a, e, changes *PoolHealthCheck) error {
return nil
}

Expand All @@ -107,6 +107,6 @@ func (p *PoolHealthCheck) RenderGCE(t *gce.GCEAPITarget, a, e, changes *PoolHeal
return nil
}

func (_ *PoolHealthCheck) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *PoolHealthCheck) error {
func (*PoolHealthCheck) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *PoolHealthCheck) error {
return nil
}
6 changes: 3 additions & 3 deletions upup/pkg/fi/cloudup/gcetasks/projectiambinding.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (e *ProjectIAMBinding) Run(c *fi.CloudupContext) error {
return fi.CloudupDefaultDeltaRunMethod(e, c)
}

func (_ *ProjectIAMBinding) CheckChanges(a, e, changes *ProjectIAMBinding) error {
func (*ProjectIAMBinding) CheckChanges(a, e, changes *ProjectIAMBinding) error {
if fi.ValueOf(e.Project) == "" {
return fi.RequiredField("Project")
}
Expand All @@ -97,7 +97,7 @@ func (_ *ProjectIAMBinding) CheckChanges(a, e, changes *ProjectIAMBinding) error
return nil
}

func (_ *ProjectIAMBinding) RenderGCE(t *gce.GCEAPITarget, a, e, changes *ProjectIAMBinding) error {
func (*ProjectIAMBinding) RenderGCE(t *gce.GCEAPITarget, a, e, changes *ProjectIAMBinding) error {
ctx := context.TODO()

projectID := fi.ValueOf(e.Project)
Expand Down Expand Up @@ -137,7 +137,7 @@ type terraformProjectIAMBinding struct {
Members []string `cty:"members"`
}

func (_ *ProjectIAMBinding) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *ProjectIAMBinding) error {
func (*ProjectIAMBinding) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *ProjectIAMBinding) error {
tf := &terraformProjectIAMBinding{
Project: fi.ValueOf(e.Project),
Role: fi.ValueOf(e.Role),
Expand Down
6 changes: 3 additions & 3 deletions upup/pkg/fi/cloudup/gcetasks/serviceaccount.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ func (e *ServiceAccount) Run(c *fi.CloudupContext) error {
return fi.CloudupDefaultDeltaRunMethod(e, c)
}

func (_ *ServiceAccount) CheckChanges(a, e, changes *ServiceAccount) error {
func (*ServiceAccount) CheckChanges(a, e, changes *ServiceAccount) error {
return nil
}

func (_ *ServiceAccount) RenderGCE(t *gce.GCEAPITarget, a, e, changes *ServiceAccount) error {
func (*ServiceAccount) RenderGCE(t *gce.GCEAPITarget, a, e, changes *ServiceAccount) error {
ctx := context.TODO()

cloud := t.Cloud
Expand Down Expand Up @@ -171,7 +171,7 @@ type terraformServiceAccount struct {
DisplayName *string `cty:"display_name"`
}

func (_ *ServiceAccount) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *ServiceAccount) error {
func (*ServiceAccount) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *ServiceAccount) error {
shared := fi.ValueOf(e.Shared)
if shared {
// Not terraform owned / managed
Expand Down

0 comments on commit bc4f045

Please sign in to comment.