About generate position independent executable

According to the go doc, for packages not named main, pie is ignored, Is there a way to generate
position independent executable if we use package not named main?

Build the listed main packages and everything they import into
position independent executables (PIE). Packages not named
main are ignored.

For my case, I compild several packages by go install to generate an executable.

in main.go and commands.go, named package main. and commands.go import package A.

As I understand, main.go commands.go and code under package A will position independent.

but package A import another package B. According to the result, some function in packages B
are not position independent.

Does any one know to how make all the code position independent? Thanks

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.