)]}'
{
  "commit": "552f8db34257fd0182aa02302bc29db1aeef7370",
  "tree": "f7b3efe46acd3bd90a7644035d80948c4deb06eb",
  "parents": [
    "6296b2fcad5a38b9d9fab92b47353c9c9ded582f"
  ],
  "author": {
    "name": "Russ Cox",
    "email": "rsc@golang.org",
    "time": "Thu Jun 28 00:23:14 2018 -0400"
  },
  "committer": {
    "name": "Russ Cox",
    "email": "rsc@golang.org",
    "time": "Tue Jul 10 05:41:21 2018 +0000"
  },
  "message": "cmd/go/internal/vgo: track directly-used vs indirectly-used modules\n\nA cleanup pass in mvs.BuildList discards modules that are not reachable\nin the requirement graph as satisfied for this build. For example, suppose:\n\n\tA -\u003e B1, C1\n\tB1 -\u003e D1\n\tB2 -\u003e nothing\n\tC1 -\u003e nothing\n\tD1 -\u003e nothing\n\tD2 -\u003e nothing\n\nThe effective build list is A, B1, C1, D1 (no cleanup possible).\n\nSuppose that we update from B1 to B2. The effective build list\nbecomes A, B2, C1, D1, and since there is no path through those\nmodule versions from A to D, the cleanup pass drops D.\n\nThis cleanup, which is not in https://research.swtch.com/vgo-mvs,\naims to avoid user confusion by not listing irrelevant modules in\nthe output of commands like \"vgo list -m all\".\n\nUnfortunately, the cleanup is not sound in general, because\nthere is no guarantee all of A\u0027s needs are listed as direct requirements.\nFor example, maybe A imports D. In that case, dropping D and then\nbuilding A will re-add the latest version of D (D2 instead of D1).\nThe most common time this happens is after an upgrade.\n\nThe fix is to make sure that go.mod does list all of the modules\nrequired directly by A, and to make sure that the go.mod\nminimizer (Algorithm R in the blog post) does not remove\ndirect requirements in the name of simplifying go.mod.\n\nThe way this is done is to annotate the requirements NOT used\ndirectly by A with a known comment, \"// indirect\".\n\nFor example suppose A imports rsc.io/quote. Then the go.mod\nlooks like it always has:\n\n\tmodule m\n\n\trequire rsc.io/quote v1.5.2\n\nBut now suppose we upgrade our packages to their latest versions.\nThen go.mod becomes:\n\n\tmodule m\n\n\trequire (\n        \t\tgolang.org/x/text v0.3.0 // indirect\n        \t\trsc.io/quote v1.5.2\n        \t\trsc.io/sampler v1.99.99 // indirect\n        \t)\n\nThe \"// indirect\" comments indicate that this requirement is used\nonly to upgrade something needed outside module m, not to satisfy\nany packages in module m itself.\n\nVgo adds and removes these comments automatically.\nIf we add a direct import of golang.org/x/text to some package in m,\nthen the first time we build that package vgo strips the \"// indirect\"\non the golang.org/x/text requirement line. If we then remove that\npackage, the requirement remains listed as direct (the conservative\nchoice) until the next \"vgo mod -sync\", which considers all packages\nin m and can mark the requirement indirect again.\nAlgorithm R is modified to be given a set of import paths that must\nbe preserved in the final output (all the ones not marked // indirect).\n\nMaintenance of this extra information makes the cleanup pass safe.\n\nSeeing all directly-imported modules in go.mod\nand distinguishing between directly- and indirectly-imported modules in go.mod\nare two of the most commonly-requested features,\nso it\u0027s extra nice that the fix for the cleanup-induced bug\nmakes go.mod closer to what users expect.\n\nFixes golang/go#24042.\nFixes golang/go#25371.\nFixes golang/go#25969.\n\nChange-Id: I4ed0729b867723fe90e836c2325f740b55b2b27b\nReviewed-on: https://go-review.googlesource.com/121304\nReviewed-by: Bryan C. Mills \u003cbcmills@google.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "ad078eee4f49dd04b0079039897df32a46ed7c55",
      "old_mode": 33188,
      "old_path": "vendor/cmd/go/internal/list/list.go",
      "new_id": "c5f0550bc04ff4c85c5613bce84db6a3066858a1",
      "new_mode": 33188,
      "new_path": "vendor/cmd/go/internal/list/list.go"
    },
    {
      "type": "modify",
      "old_id": "991f4e7d5af5c9ba89cb48b4e1c7e2d6abb44cd0",
      "old_mode": 33188,
      "old_path": "vendor/cmd/go/internal/modcmd/mod.go",
      "new_id": "82069710db39d6af87e2358b3a1912813247f047",
      "new_mode": 33188,
      "new_path": "vendor/cmd/go/internal/modcmd/mod.go"
    },
    {
      "type": "modify",
      "old_id": "6713038f5a754bcebafff4de54ef2acb7ac9f04b",
      "old_mode": 33188,
      "old_path": "vendor/cmd/go/internal/modconv/convert.go",
      "new_id": "00214783a4473c27b717d5b8e4717401da7f2536",
      "new_mode": 33188,
      "new_path": "vendor/cmd/go/internal/modconv/convert.go"
    },
    {
      "type": "modify",
      "old_id": "24bae6ba75939c7485f1bfae926c87550c90e704",
      "old_mode": 33188,
      "old_path": "vendor/cmd/go/internal/modfile/rule.go",
      "new_id": "1b9e7ba95327bc8f00e348ae3a526c719da006a2",
      "new_mode": 33188,
      "new_path": "vendor/cmd/go/internal/modfile/rule.go"
    },
    {
      "type": "modify",
      "old_id": "25deaa52cdf99b161fbbf97e34a55531e99834fd",
      "old_mode": 33188,
      "old_path": "vendor/cmd/go/internal/modinfo/info.go",
      "new_id": "5a7d6bb9aa237eb15891a511770193b61bb24de8",
      "new_mode": 33188,
      "new_path": "vendor/cmd/go/internal/modinfo/info.go"
    },
    {
      "type": "modify",
      "old_id": "7fad5135c6e05e4ef5983cb47cc2101591b61040",
      "old_mode": 33188,
      "old_path": "vendor/cmd/go/internal/module/module.go",
      "new_id": "7b32b24abf130c833c3b767ce830f9a4d79d3c40",
      "new_mode": 33188,
      "new_path": "vendor/cmd/go/internal/module/module.go"
    },
    {
      "type": "modify",
      "old_id": "a16eec0cab34417e50626cd8775f001e8af23e04",
      "old_mode": 33188,
      "old_path": "vendor/cmd/go/internal/mvs/mvs.go",
      "new_id": "03303d6e6ee3a825c954f7c7afd6ad2ff3a9b6eb",
      "new_mode": 33188,
      "new_path": "vendor/cmd/go/internal/mvs/mvs.go"
    },
    {
      "type": "modify",
      "old_id": "d52edd57243b80d484fd97ef3cad963634b030c5",
      "old_mode": 33188,
      "old_path": "vendor/cmd/go/internal/mvs/mvs_test.go",
      "new_id": "2a27dfb28890d99ea24bd95313cbddcd89d324ae",
      "new_mode": 33188,
      "new_path": "vendor/cmd/go/internal/mvs/mvs_test.go"
    },
    {
      "type": "modify",
      "old_id": "b06213fd642547002e135115db53c44e27b1d069",
      "old_mode": 33188,
      "old_path": "vendor/cmd/go/internal/vgo/build.go",
      "new_id": "6afe33699fe59e244e49031357744fd3f1f90f10",
      "new_mode": 33188,
      "new_path": "vendor/cmd/go/internal/vgo/build.go"
    },
    {
      "type": "modify",
      "old_id": "4904001d2eaee80be6e05598cfd0878225141044",
      "old_mode": 33188,
      "old_path": "vendor/cmd/go/internal/vgo/init.go",
      "new_id": "e8868bb349e87381858cbcd5e437529ddf9a1b7f",
      "new_mode": 33188,
      "new_path": "vendor/cmd/go/internal/vgo/init.go"
    },
    {
      "type": "modify",
      "old_id": "5b98d7f01dfa8be10998a49ef450709bd188cb18",
      "old_mode": 33188,
      "old_path": "vendor/cmd/go/internal/vgo/list.go",
      "new_id": "c31e9581bfe9d27010daf988d8862626836a1f2e",
      "new_mode": 33188,
      "new_path": "vendor/cmd/go/internal/vgo/list.go"
    },
    {
      "type": "modify",
      "old_id": "342fda8726860fd11e715a9b16299b131e224d65",
      "old_mode": 33188,
      "old_path": "vendor/cmd/go/internal/vgo/load.go",
      "new_id": "09244837e67151d2ee6ea1cc67ba9676122b9155",
      "new_mode": 33188,
      "new_path": "vendor/cmd/go/internal/vgo/load.go"
    },
    {
      "type": "modify",
      "old_id": "801f286609452c6925359baab1563942f4140719",
      "old_mode": 33188,
      "old_path": "vendor/cmd/go/testdata/vendormod/go.mod",
      "new_id": "d0ccb06c2f8c5cebcbfea4c166932cbf22bc10e9",
      "new_mode": 33188,
      "new_path": "vendor/cmd/go/testdata/vendormod/go.mod"
    },
    {
      "type": "modify",
      "old_id": "e38ee241491f80673e7bddd1130726bfbdb5d657",
      "old_mode": 33188,
      "old_path": "vendor/cmd/go/vgo_test.go",
      "new_id": "070412b2d7a48805b82770a0fb3a46a2829bcbfc",
      "new_mode": 33188,
      "new_path": "vendor/cmd/go/vgo_test.go"
    }
  ]
}
