robfig / glock

MIT License
230 stars 27 forks source link

Have sync create module major-release symlinks #48

Closed atavakoliyext closed 3 years ago

atavakoliyext commented 3 years ago

When a module containing a go.mod is synced, the module name may contain a major release suffix (e.g. "rsc.io/quote/v2"), indicating that the code at the module root is a post-v1 major release and that users of the module should import it with this suffix. Prior to this change, code using such a module would have had to import it without the suffix, requiring different versions of the client code to exist in order to be buildable in both module-aware and legacy-GOPATH modes.

This change creates a self-referencing major-release symlink if the imported module contains a go.mod specifying a major release suffix. This allows both legacy-GOPATH and module-aware builds to succeed, which can help users migrating from glock to Go modules avoid a hard cutover due to import path incompatibilities.

Because glock now changes the contents in GOPATH/src/... from the checked-out source, the git tagSyncCmd was updated with a -f flag, in order to force checkout and overwrite any created symlinks that might conflict with to-be-checked-out content.

robfig commented 3 years ago

(Looks like the travisci tests are a bit out of date.. still testing against go 1.3)

robfig commented 3 years ago

Updated travisci.yml. If you rebase, it should be able to run the tests.

atavakoliyext commented 3 years ago

Thanks @robfig, tests appear to be passing now!