anchor.diff:  # path to go.mod and go.sum directory
   , modRoot ? "./"
   
  -# modSha256 is the sha256 of the vendored dependencies
  +# vendorSha256 is the sha256 of the vendored dependencies
   #
  -# CAUTION: if `null` is used as a value, the derivation won't be a
  -# fixed-output derivation but disable the build sandbox instead. Don't use
  -# this in nixpkgs as Hydra won't build those packages.
  -, modSha256
  +# if vendorSha256 is null, then we won't fetch any dependencies and
  +# rely on the vendor folder within the source.
  +, vendorSha256 ? null
  +# Whether to delete the vendor folder supplied with the source.
  +, deleteVendor ? false
  +
  +, modSha256 ? null
   
   # We want parallel builds by default
   , enableParallelBuilding ? true
  
positive.code:       runHook preInstall
  
        # remove cached lookup results and tiles
        rm -rf "''${GOPATH}/pkg/mod/cache/download/sumdb"
        cp -r "''${GOPATH}/pkg/mod/cache/download" $out
  
        runHook postInstall
      '';
  
      dontFixup = true;
    }; in modArgs // (
      if modSha256 == null then
        { __noChroot = true; }
      else
        {
          outputHashMode = "recursive";
          outputHashAlgo = "sha256";
          outputHash = modSha256;
        }
    ) // overrideModAttrs modArgs);
  
    package = go.stdenv.mkDerivation (args // {
      nativeBuildInputs = [ removeReferencesTo go ] ++ nativeBuildInputs;
  
negative.code:     buildPhase = args.modBuildPhase or ''
        runHook preBuild
  
        if [ ${deleteFlag} == "true" ]; then
          rm -rf vendor
        fi
  
        if [ -e vendor ]; then
          echo "vendor folder exists, please set 'vendorSha256=null;' or 'deleteVendor=true;' in your expression"
          exit 10
        fi
        go mod vendor
        mkdir -p vendor
  
        runHook postBuild
      '';
  