properly garble symbol names with multiple private import paths in them

pull/115/head
Andrew LeFevre 5 years ago
parent 446fa77c8f
commit 4864a7ac50

@ -186,17 +186,26 @@ func garbleSymbolName(symName string, privateImports []string, sb *strings.Build
} }
func privateImportIndex(symName string, privateImports []string) (int, int) { func privateImportIndex(symName string, privateImports []string) (int, int) {
firstOff, l := -1, 0
for _, privateImport := range privateImports { for _, privateImport := range privateImports {
off := strings.Index(symName, privateImport) off := strings.Index(symName, privateImport)
if off == -1 { if off == -1 {
continue continue
} }
return off, len(privateImport)
if off < firstOff || firstOff == -1 {
firstOff = off
l = len(privateImport)
}
} }
if firstOff == -1 {
return -1, 0 return -1, 0
} }
return firstOff, l
}
func garbleSymData(data []byte, privateImports []string, dataTyp dataType, buf *bytes.Buffer) (b []byte) { func garbleSymData(data []byte, privateImports []string, dataTyp dataType, buf *bytes.Buffer) (b []byte) {
var off int var off int
for { for {

Loading…
Cancel
Save