Skip to content

Commit

Permalink
Updated for golint
Browse files Browse the repository at this point in the history
  • Loading branch information
jbristowe committed Nov 18, 2020
1 parent 876136d commit 8bd8d8b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions examples/certificates/replace_certificate.go
Expand Up @@ -37,20 +37,23 @@ func ReplaceCertificateExample() {
// get certificates
certificateList, err := client.Certificates.GetByPartialName(certificateName)
if err != nil {
// TODO: handle error
_ = fmt.Errorf("error getting certificate: %v", err)
return
}

// find the certificate with a specific name
certificate := certificateList[0]

file, err := os.Open(pfxFilePath)
if err != nil {
// TODO: handle error
_ = fmt.Errorf("error opening file path: %v", err)
return
}

data, err := ioutil.ReadAll(file)
if err != nil {
// TODO: handle error
_ = fmt.Errorf("error reading file: %v", err)
return
}

// Convert file to base64
Expand All @@ -60,6 +63,7 @@ func ReplaceCertificateExample() {
replacementCertificate := octopusdeploy.NewReplacementCertificate(base64Certificate, pfxFilePassword)
_, err = client.Certificates.Replace(certificate.GetID(), replacementCertificate)
if err != nil {
// TODO: handle error
_ = fmt.Errorf("error replacing certificate: %v", err)
return
}
}

0 comments on commit 8bd8d8b

Please sign in to comment.