-
-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support fetching original package names and import paths via reflection #904
Conversation
This function returns obfuscated names, so use that as its name. Moreover, some of the callers still called the result "objStr", which misled me into thinking the string was a unique object path. Leave a TODO behind about using go/types/objectpath too. Our own recordedObjectString is sort of similar, but not as principled.
Only two callers did pass nil, and there's no reason for them to do so. They should be the ones to check that typeToObj did not return nil.
There's no need to reach for sharedCache.ListedPackages when the caller is computePkgCache, which already has the lpkg value. While here, compare *go/types.Package pointers directly rather than via their import path strings.
Reflection can show package names alone via reflect.Type.String, and I'm sure they are available in other ways. We were obfuscating "package p" exactly like the import path "foo.com/p" which worked OK for the most part, but not for reflection. This is also a slight improvement to the quality of the obfuscation, given that package names and import paths will no longer be aligned when obfuscated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this PR is too aggressive at including import paths.
In your last commit message explain that we're doing this to support "wails" builds or things like it.
obfuscatedImportPath already handled ToObfuscate, so the callers don't have to do that as well. Handle main packages too, whose logic was sprinkled and repeated throughout the project.
92638a6
to
d3baa51
Compare
Given that we don't agree on this, and that the approach as written doesn't fix Wails anyway, I'll need to give this a second attempt in a separate PR. For now, I have updated the PR to remove package name and path deobfuscation, and fixed a failing test as well. All of the changes leading up to the original reflect change are still valuable in my opinion, and should be merged. |
(see commit messages - please do not squash)
Updates #849.