MCPcopy
hub / github.com/aws/aws-lambda-go / writeExe

Function writeExe

cmd/build-lambda-zip/main.go:44–69  ·  view source on GitHub ↗
(writer *zip.Writer, pathInZip string, data []byte)

Source from the content-addressed store, hash-verified

42}
43
44func writeExe(writer *zip.Writer, pathInZip string, data []byte) error {
45 if pathInZip != "bootstrap" {
46 header := &zip.FileHeader{Name: "bootstrap", Method: zip.Deflate}
47 header.SetMode(0755 | os.ModeSymlink)
48 link, err := writer.CreateHeader(header)
49 if err != nil {
50 return err
51 }
52 if _, err := link.Write([]byte(pathInZip)); err != nil {
53 return err
54 }
55 }
56
57 exe, err := writer.CreateHeader(&zip.FileHeader{
58 CreatorVersion: 3 << 8, // indicates Unix
59 ExternalAttrs: 0777 << 16, // -rwxrwxrwx file permissions
60 Name: pathInZip,
61 Method: zip.Deflate,
62 })
63 if err != nil {
64 return err
65 }
66
67 _, err = exe.Write(data)
68 return err
69}
70
71func compressExeAndArgs(outZipPath string, exePath string, args []string) error {
72 zipFile, err := os.Create(outZipPath)

Callers 1

compressExeAndArgsFunction · 0.85

Calls 1

WriteMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…