SHARE
TWEET

Untitled

a guest Mar 15th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. From d3008588c66317795bedc0d27abc29d85976cfaa Mon Sep 17 00:00:00 2001
  2. From: Manlio Perillo <manlio.perillo@gmail.com>
  3. Date: Mon, 11 Mar 2019 17:33:41 +0100
  4. Subject: [PATCH] cmd/go: add trust module build mode
  5.  
  6. Add the trust module build mode for interoperability with operating
  7. systems package managers.
  8. ---
  9.  src/cmd/go/internal/modfetch/fetch.go | 4 ++++
  10.  src/cmd/go/internal/work/build.go     | 2 +-
  11.  src/cmd/go/internal/work/init.go      | 2 +-
  12.  3 files changed, 6 insertions(+), 2 deletions(-)
  13.  
  14. diff --git a/src/cmd/go/internal/modfetch/fetch.go b/src/cmd/go/internal/modfetch/fetch.go
  15. index 1d6969ea3e..5b04f40e43 100644
  16. --- a/src/cmd/go/internal/modfetch/fetch.go
  17. +++ b/src/cmd/go/internal/modfetch/fetch.go
  18. @@ -281,6 +281,10 @@ var goSum struct {
  19.  // It reports whether use of go.sum is now enabled.
  20.  // The goSum lock must be held.
  21.  func initGoSum() bool {
  22. +   if cfg.BuildMod == "trust" {
  23. +       // Trust me!
  24. +       return false
  25. +   }
  26.     if GoSumFile == "" {
  27.         return false
  28.     }
  29. diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go
  30. index 145b87513a..ab8d31832c 100644
  31. --- a/src/cmd/go/internal/work/build.go
  32. +++ b/src/cmd/go/internal/work/build.go
  33. @@ -99,7 +99,7 @@ and test commands:
  34.         link against shared libraries previously created with
  35.         -buildmode=shared.
  36.     -mod mode
  37. -       module download mode to use: readonly or vendor.
  38. +       module download mode to use: readonly, trust or vendor.
  39.         See 'go help modules' for more.
  40.     -pkgdir dir
  41.         install and load all packages from dir instead of the usual locations.
  42. diff --git a/src/cmd/go/internal/work/init.go b/src/cmd/go/internal/work/init.go
  43. index 3381ab544c..ef7c15a9c2 100644
  44. --- a/src/cmd/go/internal/work/init.go
  45. +++ b/src/cmd/go/internal/work/init.go
  46. @@ -240,7 +240,7 @@ func buildModeInit() {
  47.     switch cfg.BuildMod {
  48.     case "":
  49.         // ok
  50. -   case "readonly", "vendor":
  51. +   case "readonly", "trust", "vendor":
  52.         if load.ModLookup == nil && !inGOFLAGS("-mod") {
  53.             base.Fatalf("build flag -mod=%s only valid when using modules", cfg.BuildMod)
  54.         }
  55. --
  56. 2.21.0
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top