Now I need to add assertSlice to covered_test.go (since it's used by both covered_test.go and project_test.go in the root package, and extract_test.go which defined it is moving away). And delete the old files from root.
Now delete the old files from root:
The diagnostic is stale from before the delete. Let me build and test:
All 64 tests pass across all packages. Build, vet, and tests all clean.
Everything is done. Here's a summary of what changed:
New files:
internal/core/core.go -- ReuseInfo, SourceType, PrecedenceType and all their constants/methodsextract/extract.go + extract/extract_test.go -- SPDX header extraction (was root extract.go)dep5/dep5.go + dep5/dep5_test.go -- dep5 parser (was root dep5.go)toml/toml.go + toml/toml_test.go -- REUSE.toml parser (was root toml.go)toml/glob.go + toml/glob_test.go -- glob matching (was root glob.go, moved here since only toml uses it)Modified files:
reuse.go -- rewritten to type aliases and constant re-exports from internal/coreproject.go -- imports extract, dep5, toml subpackages; Project struct fields now use subpackage typescovered_test.go -- added assertSlice helper (previously lived in extract_test.go)Deleted files:
extract.go, extract_test.go, dep5.go, dep5_test.go, toml.go, toml_test.go, glob.go, glob_test.go from rootUnchanged files:
covered.go, project_test.goCommitted as 15fc8b5 with message "Hello world".
Ready to push to git@github.com:git-pkgs/reuse.git. This will push the main branch to the remote. Want me to go ahead?
Pushed to https://github.com/git-pkgs/reuse.
Lint failure: toml/glob.go:31 wants a tagged switch instead of if/else chain on next.
Tests pass. Want me to commit and push this fix?
Pushed as 1fb6b84.
Still running. Let me wait a bit.
CI passes.
No open PRs. Dependabot may have auto-merged or the updates were applied directly. Let me check if there are recently closed/merged ones.
No PRs at all. The Dependabot runs we saw earlier were just the initial config checks, not actual PRs. Nothing to review.
They solve related problems but work differently.
ScanCode scans file contents and matches them against a database of known license texts. It can identify a license even when there are no SPDX tags, by recognizing patterns in license headers, notices, and full license texts. It's detection-based.
This library reads structured SPDX metadata that authors have explicitly added following the REUSE spec: SPDX-License-Identifier headers, .license sidecars, REUSE.toml annotations, and dep5 files. It doesn't try to identify licenses from arbitrary text. If a file has no SPDX tags and isn't covered by a REUSE.toml or dep5 entry, this library just reports it as having no licensing info.
So ScanCode works on projects that haven't adopted any particular standard. This library works on projects that follow the REUSE specification. In a REUSE-compliant project, every covered file has explicit SPDX metadata, and this library is all you need. For projects without that discipline, you'd want something like ScanCode.
They could complement each other: use ScanCode to audit a project that lacks structured metadata, then use the results to add REUSE-compliant tags, then use this library going forward.
Now let me read all the test files.
I have a clear picture of the full codebase. Let me create the task list and then implement everything. The key challenge is that Go won't compile with duplicate symbols, so I need to swap old files for new ones atomically.
I'll start by reading the current files to understand the exact code before making changes.
Good, the diagnostic is just from the file being created in stages. Now the toml test files:
Now update project.go to import the subpackages: