Conversation
Parsers now return *core.Result{Name, Version, Dependencies} instead
of []Dependency, and ParseResult gains Name and Version fields. No
parser fills them yet; this commit is the mechanical signature change
across all internal parsers and their tests so the per-format
name-extraction changes that follow are readable on their own.
Fills the new Result.Name and Result.Version fields for every manifest format that declares its own package identity: structured formats read the field from the existing unmarshal struct, code and DSL formats use a targeted regex, and filename-derived formats (csproj, nimble) fall back to the basename stem. TestParseName in manifests_test.go covers 41 fixtures across 35 formats and asserts Gemfile, requirements.txt, and lockfiles stay empty.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ParseResultnow carries the package's ownNameandVersionwhen the manifest format declares one, alongside the existingDependencies.The internal
Parser.Parsereturn type changes from[]Dependencyto*Result{Name, Version, Dependencies}; the first commit is that mechanical rewrite across all parsers so the second commit's per-format extraction is readable on its own.Coverage: go.mod, Cargo.toml, package.json/bower.json/deno.json, composer.json, pubspec.yaml, shard.yml, gleam.toml, Project.toml, dub.json, haxelib.json, vcpkg.json, META.json/META.yml, DESCRIPTION, *.cabal, elm.json, environment.yml, *.gemspec, *.podspec, mix.exs, pyproject.toml/setup.py, Package.swift, conanfile.py, project.clj, pom.xml/ivy.xml/build.sbt, .nuspec/.csproj, MODULE.bazel, lakefile.lean/lakefile.toml, *.rockspec, *.nimble, APKBUILD, PKGBUILD, *.spec.
Not populated (format has no self-name field, or the name lives in a sibling file this parser doesn't see): Gemfile, requirements.txt, build.gradle, rebar.config, Dockerfile, Cartfile, .tool-versions, pre-commit config, GitHub Actions workflows, and all lockfiles.
The immediate consumer is
git-pkgs/downstream, which needs to read the local package name from whatever manifest is present without a per-ecosystem switch.