| env GO111MODULE=on |
| [short] skip |
| |
| # Initially, we are at v1.0.0 for all dependencies. |
| cp go.mod go.mod.orig |
| go list -m all |
| stdout '^patch.example.com/direct v1.0.0' |
| stdout '^patch.example.com/indirect v1.0.0' |
| ! stdout '^patch.example.com/depofdirectpatch' |
| |
| # get -m -u=patch, with no arguments, should patch-update all dependencies, |
| # pulling in transitive dependencies and also patching those. |
| cp go.mod.orig go.mod |
| go get -m -u=patch |
| go list -m all |
| stdout '^patch.example.com/direct v1.0.1' |
| stdout '^patch.example.com/indirect v1.0.1' |
| stdout '^patch.example.com/depofdirectpatch v1.0.0' |
| |
| # 'get -m all@patch' should be equivalent to 'get -u=patch -m all' |
| cp go.mod.orig go.mod |
| go get -m all@patch |
| go list -m all |
| stdout '^patch.example.com/direct v1.0.1' |
| stdout '^patch.example.com/indirect v1.0.1' |
| stdout '^patch.example.com/depofdirectpatch v1.0.0' |
| |
| # Requesting the direct dependency with -u=patch but without an explicit version |
| # should patch-update it and its dependencies. |
| cp go.mod.orig go.mod |
| go get -m -u=patch patch.example.com/direct |
| go list -m all |
| stdout '^patch.example.com/direct v1.0.1' |
| stdout '^patch.example.com/indirect v1.0.1' |
| stdout '^patch.example.com/depofdirectpatch v1.0.1' |
| |
| # Requesting only the indirect dependency should not update the direct one. |
| cp go.mod.orig go.mod |
| go get -m -u=patch patch.example.com/indirect |
| go list -m all |
| stdout '^patch.example.com/direct v1.0.0' |
| stdout '^patch.example.com/indirect v1.0.1' |
| ! stdout '^patch.example.com/depofdirectpatch' |
| |
| # @patch should apply only to the specific module. |
| # but the result must reflect its upgraded requirements. |
| cp go.mod.orig go.mod |
| go get -m patch.example.com/direct@patch |
| go list -m all |
| stdout '^patch.example.com/direct v1.0.1' |
| stdout '^patch.example.com/indirect v1.0.0' |
| stdout '^patch.example.com/depofdirectpatch v1.0.0' |
| |
| # An explicit @patch should override a general -u. |
| cp go.mod.orig go.mod |
| go get -m -u patch.example.com/direct@patch |
| go list -m all |
| stdout '^patch.example.com/direct v1.0.1' |
| stdout '^patch.example.com/indirect v1.1.0' |
| stdout '^patch.example.com/depofdirectpatch v1.0.1' |
| |
| # An explicit @latest should override a general -u=patch. |
| cp go.mod.orig go.mod |
| go get -m -u=patch patch.example.com/direct@latest |
| go list -m all |
| stdout '^patch.example.com/direct v1.1.0' |
| stdout '^patch.example.com/indirect v1.0.1' |
| ! stdout '^patch.example.com/depofdirectpatch' |
| |
| # Standard-library modules cannot be upgraded explicitly. |
| cp go.mod.orig go.mod |
| ! go get -m std@patch |
| stderr 'explicit requirement on standard-library module std not allowed' |
| |
| |
| -- go.mod -- |
| module x |
| |
| require patch.example.com/direct v1.0.0 |
| |
| -- main.go -- |
| package x |
| import _ "patch.example.com/direct" |