Skip to content

Derive package path from version control metadata #1

@tomwhoiscontrary

Description

@tomwhoiscontrary

Most Go projects are either obtained from or will be published to a location where 'go get' is able to obtain them, known as remote import paths. This comprises repositories of one of the supported version control systems, namely Bazaar, Git, Mercurial, and Subversion.

Given that the set of supported version control systems is finite, and small, it might be worth considering deriving the package path from the metadata of whichever one of these version control systems is in use, if there is one. The existing package.path file could be retained, and i suppose would override anything present in the version control metadata.

Exactly how the derivation would be defined is up for debate, but should work with the common cases of a straightforward checkout from GitHub etc. So, for Git, look for a file called .git/config, and look inside for a section called remote "origin", in which there should be a property url. For Mercurial, look for a file called .hg/hgrc, and look inside for a section called paths, in which there should be a property default. For Bazaar, god alone knows. For Subversion, open .svn/wc.db as a SQLite database and run select root from REPOSITORY; (yes, really). Or, for all of them, just assume the VCS is installed locally and run whatever command is needed to determine the remote path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions