mirror of
https://github.com/danog/gllvm.git
synced 2024-11-30 06:08:58 +01:00
reduce cyclomatic complexity for my GPA. Sucks.
This commit is contained in:
parent
0c39531dd6
commit
114f1e8ed4
@ -59,26 +59,64 @@ func getFileType(realPath string) (fileType int) {
|
||||
LogFatal("There was an error getting the type of %s. Make sure that the 'file' command is installed.", realPath)
|
||||
}
|
||||
|
||||
// Test the output
|
||||
if fo := string(out); strings.Contains(fo, "ELF") && strings.Contains(fo, "executable") {
|
||||
fileType = fileTypeELFEXECUTABLE
|
||||
} else if strings.Contains(fo, "Mach-O") && strings.Contains(fo, "executable") {
|
||||
fileType = fileTypeMACHEXECUTABLE
|
||||
} else if strings.Contains(fo, "ELF") && strings.Contains(fo, "shared") {
|
||||
fileType = fileTypeELFSHARED
|
||||
} else if strings.Contains(fo, "Mach-O") && strings.Contains(fo, "dynamically linked shared") {
|
||||
fileType = fileTypeMACHSHARED
|
||||
fo := string(out)
|
||||
|
||||
if strings.Contains(fo, "ELF") {
|
||||
|
||||
if strings.Contains(fo, "executable") {
|
||||
fileType = fileTypeELFEXECUTABLE
|
||||
} else if strings.Contains(fo, "shared") {
|
||||
fileType = fileTypeELFSHARED
|
||||
} else if strings.Contains(fo, "relocatable") {
|
||||
fileType = fileTypeELFOBJECT
|
||||
} else {
|
||||
fileType = fileTypeUNDEFINED
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else if strings.Contains(fo, "Mach-O") {
|
||||
|
||||
if strings.Contains(fo, "executable") {
|
||||
fileType = fileTypeMACHEXECUTABLE
|
||||
} else if strings.Contains(fo, "dynamically linked shared") {
|
||||
fileType = fileTypeMACHSHARED
|
||||
} else if strings.Contains(fo, "object") {
|
||||
fileType = fileTypeMACHOBJECT
|
||||
} else {
|
||||
fileType = fileTypeUNDEFINED
|
||||
}
|
||||
|
||||
} else if strings.Contains(fo, "current ar archive") {
|
||||
fileType = fileTypeARCHIVE
|
||||
} else if strings.Contains(fo, "thin archive") {
|
||||
fileType = fileTypeTHINARCHIVE
|
||||
} else if strings.Contains(fo, "ELF") && strings.Contains(fo, "relocatable") {
|
||||
fileType = fileTypeELFOBJECT
|
||||
} else if strings.Contains(fo, "Mach-O") && strings.Contains(fo, "object") {
|
||||
fileType = fileTypeMACHOBJECT
|
||||
} else {
|
||||
} else {
|
||||
fileType = fileTypeUNDEFINED
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Test the output
|
||||
// if fo := string(out); strings.Contains(fo, "ELF") && strings.Contains(fo, "executable") {
|
||||
// fileType = fileTypeELFEXECUTABLE
|
||||
// } else if strings.Contains(fo, "Mach-O") && strings.Contains(fo, "executable") {
|
||||
// fileType = fileTypeMACHEXECUTABLE
|
||||
// } else if strings.Contains(fo, "ELF") && strings.Contains(fo, "shared") {
|
||||
// fileType = fileTypeELFSHARED
|
||||
// } else if strings.Contains(fo, "Mach-O") && strings.Contains(fo, "dynamically linked shared") {
|
||||
// fileType = fileTypeMACHSHARED
|
||||
// } else if strings.Contains(fo, "current ar archive") {
|
||||
// fileType = fileTypeARCHIVE
|
||||
// } else if strings.Contains(fo, "thin archive") {
|
||||
// fileType = fileTypeTHINARCHIVE
|
||||
// } else if strings.Contains(fo, "ELF") && strings.Contains(fo, "relocatable") {
|
||||
// fileType = fileTypeELFOBJECT
|
||||
// } else if strings.Contains(fo, "Mach-O") && strings.Contains(fo, "object") {
|
||||
// fileType = fileTypeMACHOBJECT
|
||||
// } else {
|
||||
// fileType = fileTypeUNDEFINED
|
||||
// }
|
||||
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user