First sweep at cleaning up dead code

first round of a number I am sure, lots to clean.

Signed-off-by: quobix <dave@quobix.com>
This commit is contained in:
quobix
2023-10-21 18:26:21 -04:00
parent be7e477529
commit 28047d08d2
15 changed files with 225 additions and 1478 deletions

View File

@@ -57,54 +57,3 @@ func ExtractFileType(ref string) FileExtension {
}
return UNSUPPORTED
}
func ExtractRefValues(ref string) (location, id string) {
split := strings.Split(ref, "#/")
if len(split) > 1 && split[0] != "" {
location = split[0]
id = split[1]
}
if len(split) > 1 && split[0] == "" {
id = split[1]
}
if len(split) == 1 {
location = ref
}
return
}
func ExtractRefType(ref string) RefType {
if strings.HasPrefix(ref, "http") {
return HTTP
}
if strings.HasPrefix(ref, "/") {
return File
}
if strings.HasPrefix(ref, "..") {
return File
}
if strings.HasPrefix(ref, "./") {
return File
}
split := strings.Split(ref, "#/")
if len(split) > 1 && split[0] != "" {
return File
}
if strings.HasSuffix(ref, ".yaml") {
return File
}
if strings.HasSuffix(ref, ".json") {
return File
}
return Local
}
func ExtractRefs(content string) [][]string {
return refRegex.FindAllStringSubmatch(content, -1)
//var results []*ExtractedRef
//for _, r := range res {
// results = append(results, &ExtractedRef{Location: r[1], Type: ExtractRefType(r[1])})
//}
}