Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update golangci-lint configuration #1426

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tenthirtyam
Copy link
Collaborator

Summary of Pull Request

Updates golangci-lint configuration.

Type of Pull Request

  • This is a bug fix.
  • This is an enhancement or feature.
  • This is a code style/formatting update.
  • This is a documentation update.
  • This is a refactoring update.
  • This is a chore update
  • This is something else.
    Please describe:

Related to Existing Issues

Test and Documentation Coverage

For bug fixes or features:

  • Tests have been completed.
  • Documentation has been added/updated.

BEFORE:

golangci-lint run
WARN [config_reader] The configuration option `linters.errcheck.ignore` is deprecated, please use `linters.errcheck.exclude-functions`. 

AFTER:

golangci-lint run
nsxt/metadata/metadata.go:187:10: Error return value of `d.Set` is not checked (errcheck)
                                d.Set(key, nestedVal)
                                     ^
nsxt/metadata/metadata.go:205:10: Error return value of `d.Set` is not checked (errcheck)
                                d.Set(key, nestedSlice)
                                     ^
nsxt/metadata/metadata.go:215:11: Error return value of `d.Set` is not checked (errcheck)
                                        d.Set(key, nestedSlice.Interface())
                                             ^
nsxt/provider.go:1192:17: Error return value is not checked (errcheck)
                initNSXVersion(connector)
                              ^
nsxt/removed_resource_wrapper.go:14:16: Error return value is not checked (errcheck)
        initNSXVersion(getPolicyConnector(m))
                      ^
nsxt/resource_nsxt_compute_manager.go:388:29: Error return value is not checked (errcheck)
        setCredentialValuesInSchema(d, obj.Credential)
                                   ^
nsxt/resource_nsxt_upgrade_run.go:469:37: Error return value of `upgradeClientSet.PlanClient.Pause` is not checked (errcheck)
                        upgradeClientSet.PlanClient.Pause()
                                                         ^
nsxt/resource_nsxt_upgrade_run.go:867:42: Error return value of `upgradeClient.Executepostupgradechecks` is not checked (errcheck)
                        upgradeClient.Executepostupgradechecks(component)
                                                              ^
nsxt/provider.go:721:46: G402: TLS InsecureSkipVerify set true. (gosec)
        tlsConfig := tls.Config{InsecureSkipVerify: insecure}
                                                    ^
nsxt/provider.go:1133:17: G404: Use of weak random number generator (math/rand or math/rand/v2 instead of crypto/rand) (gosec)
                        interval := (rand.Intn(max-min) + min)
                                     ^
nsxt/resource_nsxt_manager_cluster.go:273:16: G404: Use of weak random number generator (math/rand or math/rand/v2 instead of crypto/rand) (gosec)
                interval := (rand.Intn(max-min) + min)
                             ^
nsxt/provider_test.go:161:52: G402: TLS InsecureSkipVerify set true. (gosec)
                TLSClientConfig: &tls.Config{InsecureSkipVerify: insecure},
                                                                 ^
nsxt/utils_test.go:79:53: G404: Use of weak random number generator (math/rand or math/rand/v2 instead of crypto/rand) (gosec)
        return fmt.Sprintf("%s-%d", testAccDataSourceName, rand.Intn(100000))
                                                           ^
nsxt/provider.go:1146:97: G115: integer overflow conversion int -> uint (gosec)
                connectorOptions = append(connectorOptions, client.WithDecorators(retry.NewRetryDecorator(uint(c.CommonConfig.MaxRetries), retryFunc)))
                                                                                                              ^
nsxt/resource_nsxt_lb_client_ssl_profile.go:149:19: G115: integer overflow conversion int -> int32 (gosec)
        revision := int32(d.Get("revision").(int))
                         ^
nsxt/resource_nsxt_lb_cookie_persistence_profile.go:260:19: G115: integer overflow conversion int -> int32 (gosec)
        revision := int32(d.Get("revision").(int))
                         ^
nsxt/resource_nsxt_lb_fast_tcp_application_profile.go:142:19: G115: integer overflow conversion int -> int32 (gosec)
        revision := int32(d.Get("revision").(int))
                         ^
nsxt/resource_nsxt_logical_router_downlink_port.go:86:22: G115: integer overflow conversion uint64 -> int64 (gosec)
                PrefixLength: int64(prefix),
                                   ^
nsxt/validators.go:22:13: G115: integer overflow conversion int -> uint64 (gosec)
                i = uint64(vi)
                          ^

Breaking Changes?

  • Yes, there are breaking changes.
  • No, there are no breaking changes.

Updates `golangci-lint` configuration.

Signed-off-by: Ryan Johnson <[email protected]>
@tenthirtyam tenthirtyam added technical-debt Technical Debt chore Chore labels Oct 12, 2024
@tenthirtyam tenthirtyam self-assigned this Oct 12, 2024
@tenthirtyam tenthirtyam added needs-review Needs Review size/s Relative Sizing: small labels Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Chore needs-review Needs Review size/s Relative Sizing: small technical-debt Technical Debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant