(fileData []byte, conf map[string]string)
| 35 | } |
| 36 | |
| 37 | func scanSlice(fileData []byte, conf map[string]string) (bool, error) { |
| 38 | // Create a temp file to scan |
| 39 | tempFile, err := os.CreateTemp("", "slice_scan_") |
| 40 | if err != nil { |
| 41 | return false, fmt.Errorf("failed to create temp file: %v", err) |
| 42 | } |
| 43 | |
| 44 | // Defer cleanup |
| 45 | defer os.Remove(tempFile.Name()) |
| 46 | defer tempFile.Close() |
| 47 | |
| 48 | _, err = tempFile.Write(fileData) |
| 49 | if err != nil { |
| 50 | return false, fmt.Errorf("failed to write to temp file: %v", err) |
| 51 | } |
| 52 | |
| 53 | // Scan the file slice |
| 54 | scanResult, err := scanFile(tempFile.Name(), conf) |
| 55 | if err != nil { |
| 56 | return false, fmt.Errorf("failed to scan temp file: %v", err) |
| 57 | } |
| 58 | |
| 59 | return scanResult, nil |
| 60 | } |
| 61 | |
| 62 | func checkStatic(binaryPath string, conf map[string]string) (string, error) { |
| 63 | // Read the files content |
no test coverage detected