Absolute paths & forked libraries

This stackoverflow question covers most of my question. https://stackoverflow.com/questions/32166642/how-to-handle-go-import-absolute-paths-and-github-forks

Being still relatively new to Go, I wanted to ask around before I make a pass on the language.

Is there a built in method to redirect the base path of a package? Not looking for a tool to mangle an entire package to fix the absolute path, create symlinks, etc.

Reasons could be wanting to self host dependencies, use my forked version of a package for whatever reason, etc.

Even with Composer for PHP, you can do this easily. I feel like I’m missing something incredibly simple here. If not, it is what it is I suppose.

For this purpose, a dependency management tool like glide or the upcoming dep might be what you are looking for. These tools let you pin version numbers (exact or by range) of your application’s dependencies.

If you fork a package project, it would make more sense to me to actually rewrite the import paths than to rely on a tool (and some config file somewhere) to constantly redirect the paths in the background at compile time. If you fork a package in order to modify it, sooner or later you can’t transparently switch back to the original package anymore because of functionality drift, and then you don’t need the original import path anyway.

1 Like

Thanks Chris, will look more into glide and dep.

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