Skip to content

Commit 47560c4

Browse files
author
Ivan De Marino
committed
Linter gotchas
1 parent 482f063 commit 47560c4

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

internal/provider/data_source_certificate.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,9 @@ func fetchPeerCertificatesViaHTTPS(targetURL *url.URL, shouldVerifyChain bool, c
191191

192192
// Fist attempting an HTTP HEAD: if it fails, ignore errors and move on
193193
resp, err := client.Head(targetURL.String())
194-
if err == nil {
194+
if err == nil && resp.TLS != nil && len(resp.TLS.PeerCertificates) > 0 {
195195
defer resp.Body.Close()
196-
if resp != nil && resp.TLS != nil && len(resp.TLS.PeerCertificates) > 0 {
197-
return resp.TLS.PeerCertificates, nil
198-
}
196+
return resp.TLS.PeerCertificates, nil
199197
}
200198

201199
// Then attempting HTTP GET: if this fails we will than report the error
@@ -204,7 +202,7 @@ func fetchPeerCertificatesViaHTTPS(targetURL *url.URL, shouldVerifyChain bool, c
204202
return nil, fmt.Errorf("failed to fetch certificates from URL '%s': %w", targetURL.Scheme, err)
205203
}
206204
defer resp.Body.Close()
207-
if resp != nil && resp.TLS != nil && len(resp.TLS.PeerCertificates) > 0 {
205+
if resp.TLS != nil && len(resp.TLS.PeerCertificates) > 0 {
208206
return resp.TLS.PeerCertificates, nil
209207
}
210208

internal/provider/provider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func New() *schema.Provider {
7171
}
7272
}
7373

74-
// providerConfig is produced by configureProvider as part of the provider initialization
74+
// providerConfig is produced by configureProvider as part of the provider initialization.
7575
type providerConfig struct {
7676
proxyURL *url.URL
7777
proxyFromEnv bool

0 commit comments

Comments
 (0)