unixpickle / gobfuscate

Obfuscate Go binaries and packages
BSD 2-Clause "Simplified" License
1.45k stars 157 forks source link

Does not work if struct is defined after use #19

Open CaledoniaProject opened 5 years ago

CaledoniaProject commented 5 years ago

gobfuscate does not work with the following code (shortened):

package main

import (
    "fmt"
)

type Test1 struct {
    data map[int]pathInfo
}

type pathInfo struct {
    name string
}

func main() {
    fmt.Println("Hello There!")
}

It complains with XXX has no member "pathInfo". The only solution is to modify the source code and move pathInfo definition above Test1 structure.

Can you fix it?

CaledoniaProject commented 5 years ago

Looks like go itself scans the source code twice. Minimal case updated.