MCPcopy
hub / github.com/jackc/pgx / writeCertificate

Function writeCertificate

testsetup/generate_certs.go:166–186  ·  view source on GitHub ↗
(path string, certBytes []byte)

Source from the content-addressed store, hash-verified

164}
165
166func writeCertificate(path string, certBytes []byte) error {
167 file, err := os.Create(path)
168 if err != nil {
169 return fmt.Errorf("writeCertificate: %w", err)
170 }
171
172 err = pem.Encode(file, &pem.Block{
173 Type: "CERTIFICATE",
174 Bytes: certBytes,
175 })
176 if err != nil {
177 return fmt.Errorf("writeCertificate: %w", err)
178 }
179
180 err = file.Close()
181 if err != nil {
182 return fmt.Errorf("writeCertificate: %w", err)
183 }
184
185 return nil
186}

Callers 1

mainFunction · 0.85

Calls 3

CreateMethod · 0.80
EncodeMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected