Skip to content
This repository was archived by the owner on Feb 11, 2025. It is now read-only.

Commit da0a83c

Browse files
mtekelmaxmoehl
authored andcommitted
ci: DRY FileMode
1 parent 9a5a63b commit da0a83c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/pcap/test/integration/helpers.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"errors"
1414
"fmt"
1515
"io"
16+
"io/fs"
1617
"math/big"
1718
"net"
1819
"os"
@@ -173,20 +174,21 @@ func generateCerts(commonName string, dir string) (string, string, string, error
173174
return "", "", "", err
174175
}
175176

177+
certPerms := fs.FileMode(0600)
176178
certPath := path.Join(dir, "cert.pem")
177179
keyPath := path.Join(dir, "private.key")
178180
caPath := path.Join(dir, "ca.pem")
179-
err = os.WriteFile(certPath, certPEM.Bytes(), 0600)
181+
err = os.WriteFile(certPath, certPEM.Bytes(), certPerms)
180182
if err != nil {
181183
return "", "", "", err
182184
}
183185

184-
err = os.WriteFile(keyPath, certPrivKeyPEM.Bytes(), 0600)
186+
err = os.WriteFile(keyPath, certPrivKeyPEM.Bytes(), certPerms)
185187
if err != nil {
186188
return "", "", "", err
187189
}
188190

189-
err = os.WriteFile(caPath, caPEM.Bytes(), 0600)
191+
err = os.WriteFile(caPath, caPEM.Bytes(), certPerms)
190192
if err != nil {
191193
return "", "", "", err
192194
}

0 commit comments

Comments
 (0)