Ejemplo n.º 1
0
                    // Replacement returns the replacement for mod, if any, from go.mod.
                    // If there is no replacement for mod, Replacement returns
                    // a module.Version with Path == "".
                    public static module.Version Replacement(module.Version mod)
                    {
                        if (index != null)
                        {
                            {
                                var r__prev2 = r;

                                var(r, ok) = index.replace[mod];

                                if (ok)
                                {
                                    return(r);
                                }

                                r = r__prev2;
                            }

                            {
                                var r__prev2 = r;

                                (r, ok) = index.replace[new module.Version(Path: mod.Path)];

                                if (ok)
                                {
                                    return(r);
                                }

                                r = r__prev2;
                            }
                        }

                        return(new module.Version());
                    }
Ejemplo n.º 2
0
 public ImportMissingError(@string Path = default, module.Version Module = default, error QueryErr = default, @string newMissingVersion = default)
 {
     this.Path              = Path;
     this.Module            = Module;
     this.QueryErr          = QueryErr;
     this.newMissingVersion = newMissingVersion;
 }
Ejemplo n.º 3
0
 public PackageNotInModuleError(module.Version Mod = default, module.Version Replacement = default, @string Query = default, @string Pattern = default)
 {
     this.Mod         = Mod;
     this.Replacement = Replacement;
     this.Query       = Query;
     this.Pattern     = Pattern;
 }
Ejemplo n.º 4
0
 public modGraphNode(module.Version m = default, slice <module.Version> required = default, module.Version upgrade = default, error err = default)
 {
     this.m        = m;
     this.required = required;
     this.upgrade  = upgrade;
     this.err      = err;
 }
Ejemplo n.º 5
0
 public fileJSON(module.Version Module = default, @string Go = default, slice <requireJSON> Require = default, slice <module.Version> Exclude = default, slice <replaceJSON> Replace = default)
 {
     this.Module  = Module;
     this.Go      = Go;
     this.Require = Require;
     this.Exclude = Exclude;
     this.Replace = Replace;
 }
Ejemplo n.º 6
0
 public loadPkg(@string path = default, module.Version mod = default, @string dir = default, slice <ptr <loadPkg> > imports = default, error err = default, ref ptr <loadPkg> stack = default, ref ptr <loadPkg> test = default, ref ptr <loadPkg> testOf = default, slice <@string> testImports = default)
 {
     this.path        = path;
     this.mod         = mod;
     this.dir         = dir;
     this.imports     = imports;
     this.err         = err;
     this.stack       = stack;
     this.test        = test;
     this.testOf      = testOf;
     this.testImports = testImports;
 }
Ejemplo n.º 7
0
                    // readVendorList reads the list of vendored modules from vendor/modules.txt.
                    private static void readVendorList()
                    {
                        vendorOnce.Do(() =>
                        {
                            vendorList      = null;
                            vendorPkgModule = make_map <@string, module.Version>();
                            vendorVersion   = make_map <@string, @string>();
                            vendorMeta      = make_map <module.Version, vendorMetadata>();
                            var(data, err)  = ioutil.ReadFile(filepath.Join(ModRoot(), "vendor/modules.txt"));
                            if (err != null)
                            {
                                if (!errors.Is(err, os.ErrNotExist))
                                {
                                    @base.Fatalf("go: %s", err);
                                }

                                return;
                            }

                            module.Version mod = default;
                            foreach (var(_, line) in strings.Split(string(data), "\n"))
                            {
                                if (strings.HasPrefix(line, "# "))
                                {
                                    var f = strings.Fields(line);

                                    if (len(f) < 3L)
                                    {
                                        continue;
                                    }

                                    if (semver.IsValid(f[2L]))
                                    {
                                        // A module, but we don't yet know whether it is in the build list or
                                        // only included to indicate a replacement.
                                        mod = new module.Version(Path: f[1], Version: f[2]);
                                        f   = f[3L..];
                                    }
Ejemplo n.º 8
0
 public modFileIndex(slice <byte> data = default, bool dataNeedsFix = default, module.Version module = default, @string goVersion = default, map <module.Version, requireMeta> require = default, map <module.Version, module.Version> replace = default, map <module.Version, bool> exclude = default)
 {
     this.data         = data;
     this.dataNeedsFix = dataNeedsFix;
     this.module       = module;
     this.goVersion    = goVersion;
     this.require      = require;
     this.replace      = replace;
     this.exclude      = exclude;
 }
Ejemplo n.º 9
0
 // lookupSumDB returns the Go checksum database's go.sum lines for the given module,
 // along with the name of the database.
 private static (@string, slice <@string>, error) lookupSumDB(module.Version mod)
 {
     @string         dbname = default;
     slice <@string> lines  = default;
     error           err    = default !;
Ejemplo n.º 10
0
 public vendorMetadata(bool Explicit = default, module.Version Replacement = default)
 {
     this.Explicit    = Explicit;
     this.Replacement = Replacement;
 }
Ejemplo n.º 11
0
 // useSumDB reports whether to use the Go checksum database for the given module.
 private static bool useSumDB(module.Version mod)
 {
     return(cfg.GOSUMDB != "off" && !get.Insecure && !str.GlobsMatchPath(cfg.GONOSUMDB, mod.Path));
 }
Ejemplo n.º 12
0
 private static bool useSumDB(module.Version mod)
 {
     return(false);
 }
Ejemplo n.º 13
0
 public lostUpgradeReqs(mvs.Reqs Reqs = default, module.Version lost = default)
 {
     this.Reqs = Reqs;
     this.lost = lost;
 }
Ejemplo n.º 14
0
 private delegate(module.Version, error) PreviousByVal(T value, module.Version m);
Ejemplo n.º 15
0
 public Exclude(module.Version Mod = default, ref ptr <Line> Syntax = default)
 {
     this.Mod    = Mod;
     this.Syntax = Syntax;
 }
Ejemplo n.º 16
0
 private delegate(module.Version, error) UpgradeByVal(T value, module.Version m);
Ejemplo n.º 17
0
 private delegate(module.Version, error) UpgradeByRef(ref T value, module.Version m);
Ejemplo n.º 18
0
 private delegate(module.Version, error) RequiredByRef(ref T value, module.Version m);
Ejemplo n.º 19
0
 private delegate(module.Version, error) RequiredByVal(T value, module.Version m);
Ejemplo n.º 20
0
 public @override(module.Version target = default, slice <module.Version> list = default, Reqs Reqs = default)
 {
     this.target = target;
     this.list   = list;
     this.Reqs   = Reqs;
 }
Ejemplo n.º 21
0
 public Require(module.Version Mod = default, bool Indirect = default, ref ptr <Line> Syntax = default)
 {
     this.Mod      = Mod;
     this.Indirect = Indirect;
     this.Syntax   = Syntax;
 }
Ejemplo n.º 22
0
 public querySpec(@string path = default, @string vers = default, bool forceModulePath = default, module.Version prevM = default)
 {
     this.path            = path;
     this.vers            = vers;
     this.forceModulePath = forceModulePath;
     this.prevM           = prevM;
 }
Ejemplo n.º 23
0
 // Allowed reports whether module m is allowed (not excluded) by the main module's go.mod.
 public static bool Allowed(module.Version m)
 {
     return(index == null || !index.exclude[m]);
 }
Ejemplo n.º 24
0
 // Download downloads the specific module version to the
 // local download cache and returns the name of the directory
 // corresponding to the root of the module's file tree.
 public static (@string, error) Download(module.Version mod)
 {
     @string dir = default;
     error err = default!;
Ejemplo n.º 25
0
 private static (@string, slice <@string>, error) lookupSumDB(module.Version mod) => func((_, panic, __) =>
Ejemplo n.º 26
0
 public Replace(module.Version Old = default, module.Version New = default, ref ptr <Line> Syntax = default)
 {
     this.Old    = Old;
     this.New    = New;
     this.Syntax = Syntax;
 }
Ejemplo n.º 27
0
 private delegate(module.Version, error) PreviousByRef(ref T value, module.Version m);
Ejemplo n.º 28
0
 public QueryResult(module.Version Mod = default, ref ptr <modfetch.RevInfo> Rev = default, slice <@string> Packages = default)
 {
     this.Mod      = Mod;
     this.Rev      = Rev;
     this.Packages = Packages;
 }
Ejemplo n.º 29
0
 public buildListErrorElem(module.Version m = default, @string nextReason = default)
 {
     this.m          = m;
     this.nextReason = nextReason;
 }
Ejemplo n.º 30
0
 public (module.Version, error) Previous(module.Version m) => s_PreviousByRef?.Invoke(ref this, m) ?? s_PreviousByVal?.Invoke(this, m) ?? Reqs?.Previous(m) ?? throw new PanicException(RuntimeErrorPanic.NilPointerDereference);