Repository: G-Rath/osv-detector
Pull request #66 (2022-03-12 22:59:32)

refactor: rename `semver` package to `internal`
Technically this is more than a refactor, since `internal` has special meaning in Go - ultimately these packages weren't meant to be publicly used as this is a CLI-first program rather than a library.

I'm totally open to discussing making these packages public in the future (in particular from what I found when looking up semantic version packages, I think `semantic` could be useful), but right now I'm not wanting to commit to a public API and am very conscious of how Go considers public packages just straight up public vs there are some functions I'd prefer having tests for which require they be "public".

The actual main drive behind this was that I didn't like `detector` because it was `osv-detector/detector` - the rest is just a little peace-of-mind bonus.


Patch:
diff --git a/detector/lockfile/types.go b/detector/lockfile/types.go
deleted file mode 100644
index 4e40b2a..0000000
--- a/detector/lockfile/types.go
+++ /dev/null
@@ -1,7 +0,0 @@
-package lockfile
-
-import "osv-detector/detector"
-
-type Ecosystem = detector.Ecosystem
-type PackageDetails = detector.PackageDetails
-type PackageDetailsParser = func(pathToLockfile string) ([]PackageDetails, error)
diff --git a/detector/database/cache.go b/internal/database/cache.go
similarity index 100%
rename from detector/database/cache.go
rename to internal/database/cache.go
diff --git a/detector/database/ecosystems.go b/internal/database/ecosystems.go
similarity index 100%
rename from detector/database/ecosystems.go
rename to internal/database/ecosystems.go
diff --git a/detector/database/load.go b/internal/database/load.go
similarity index 100%
rename from detector/database/load.go
rename to internal/database/load.go
diff --git a/detector/database/new.go b/internal/database/new.go
similarity index 100%
rename from detector/database/new.go
rename to internal/database/new.go
diff --git a/detector/database/osv.go b/internal/database/osv.go
similarity index 95%
rename from detector/database/osv.go
rename to internal/database/osv.go
index 3fcd152..3f299e6 100644
--- a/detector/database/osv.go
+++ b/internal/database/osv.go
@@ -3,9 +3,9 @@ package database
 import (
 	"fmt"
 	"os"
-	"osv-detector/detector"
-	"osv-detector/detector/lockfile"
-	"osv-detector/detector/semantic"
+	"osv-detector/internal"
+	"osv-detector/internal/lockfile"
+	"osv-detector/internal/semantic"
 	"regexp"
 	"strings"
 	"time"
@@ -20,7 +20,7 @@ const (
 	TypeGit       AffectsRangeType = "GIT"
 )
 
-type Ecosystem = detector.Ecosystem
+type Ecosystem = internal.Ecosystem
 
 type Package struct {
 	Name      string    `json:"name"`
@@ -151,7 +151,7 @@ func (osv *OSV) isAliasOf(vulnerability OSV) bool {
 	return false
 }
 
-func (osv *OSV) AffectsEcosystem(ecosystem detector.Ecosystem) bool {
+func (osv *OSV) AffectsEcosystem(ecosystem internal.Ecosystem) bool {
 	if osv.Affected == nil {
 		fmt.Printf("Ignoring %s as it does not have an 'affected' property\n", osv.ID)
 
@@ -225,7 +225,7 @@ func (osv *OSV) Link() string {
 	return ""
 }
 
-func (osv *OSV) IsAffected(pkg detector.PackageDetails) bool {
+func (osv *OSV) IsAffected(pkg internal.PackageDetails) bool {
 	if osv.Affected == nil {
 		fmt.Printf("Ignoring %s as it does not have an 'affected' property\n", osv.ID)
 
diff --git a/detector/database/vulnerabilities.go b/internal/database/vulnerabilities.go
similarity index 87%
rename from detector/database/vulnerabilities.go
rename to internal/database/vulnerabilities.go
index 856616f..2ef3187 100644
--- a/detector/database/vulnerabilities.go
+++ b/internal/database/vulnerabilities.go
@@ -1,8 +1,6 @@
 package database
 
-import (
-	"osv-detector/detector"
-)
+import "osv-detector/internal"
 
 func (db *OSVDatabase) Vulnerabilities(includeWithdrawn bool) []OSV {
 	if includeWithdrawn {
@@ -39,7 +37,7 @@ func (vs Vulnerabilities) Includes(vulnerability OSV) bool {
 	return false
 }
 
-func (db *OSVDatabase) VulnerabilitiesAffectingPackage(pkg detector.PackageDetails) Vulnerabilities {
+func (db *OSVDatabase) VulnerabilitiesAffectingPackage(pkg internal.PackageDetails) Vulnerabilities {
 	var vulnerabilities Vulnerabilities
 
 	for _, vulnerability := range db.Vulnerabilities(false) {
diff --git a/internal/lockfile/types.go b/internal/lockfile/types.go
new file mode 100644
index 0000000..4cc455a
--- /dev/null
+++ b/internal/lockfile/types.go
@@ -0,0 +1,7 @@
+package lockfile
+
+import "osv-detector/internal"
+
+type Ecosystem = internal.Ecosystem
+type PackageDetails = internal.PackageDetails
+type PackageDetailsParser = func(pathToLockfile string) ([]PackageDetails, error)
diff --git a/detector/semantic/version.go b/internal/semantic/version.go
similarity index 100%
rename from detector/semantic/version.go
rename to internal/semantic/version.go
diff --git a/detector/types.go b/internal/types.go
similarity index 86%
rename from detector/types.go
rename to internal/types.go
index c54d686..0a6c663 100644
--- a/detector/types.go
+++ b/internal/types.go
@@ -1,4 +1,4 @@
-package detector
+package internal
 
 type PackageDetails struct {
 	Name      string
diff --git a/main.go b/main.go
index bf0f214..a608f34 100644
--- a/main.go
+++ b/main.go
@@ -6,9 +6,9 @@ import (
 	"fmt"
 	"github.com/fatih/color"
 	"os"
-	"osv-detector/detector"
-	"osv-detector/detector/database"
-	"osv-detector/detector/lockfile"
+	"osv-detector/internal"
+	"osv-detector/internal/database"
+	"osv-detector/internal/lockfile"
 	"path"
 )
 
@@ -46,7 +46,7 @@ func printEcosystems(db database.OSVDatabase) {
 	}
 }
 
-func printPackages(pathToLock string, packages []detector.PackageDetails) {
+func printPackages(pathToLock string, packages []internal.PackageDetails) {
 	fmt.Printf("The following packages were found in %s:\n", pathToLock)
 
 	for _, details := range packages {
@@ -54,7 +54,7 @@ func printPackages(pathToLock string, packages []detector.PackageDetails) {
 	}
 }
 
-func printVulnerabilities(db database.OSVDatabase, pkg detector.PackageDetails) int {
+func printVulnerabilities(db database.OSVDatabase, pkg internal.PackageDetails) int {
 	vulnerabilities := db.VulnerabilitiesAffectingPackage(pkg)
 
 	if len(vulnerabilities) == 0 {
@@ -78,13 +78,13 @@ func printVulnerabilities(db database.OSVDatabase, pkg detector.PackageDetails)
 	return len(vulnerabilities)
 }
 
-func ecosystemDatabaseURL(ecosystem detector.Ecosystem) string {
+func ecosystemDatabaseURL(ecosystem internal.Ecosystem) string {
 	return fmt.Sprintf("https://osv-vulnerabilities.storage.googleapis.com/%s/all.zip", ecosystem)
 }
 
 type OSVDatabases []database.OSVDatabase
 
-func loadEcosystemDatabases(ecosystems []detector.Ecosystem, offline bool) OSVDatabases {
+func loadEcosystemDatabases(ecosystems []internal.Ecosystem, offline bool) OSVDatabases {
 	dbs := make(OSVDatabases, 0, len(ecosystems))
 
 	fmt.Printf("Loading OSV databases for the following ecosystems:\n")


Test patch:
diff --git a/detector/database/osv_test.go b/internal/database/osv_test.go
similarity index 97%
rename from detector/database/osv_test.go
rename to internal/database/osv_test.go
index 4ecc965..31bd788 100644
--- a/detector/database/osv_test.go
+++ b/internal/database/osv_test.go
@@ -1,9 +1,9 @@
 package database_test
 
 import (
-	"osv-detector/detector"
-	"osv-detector/detector/database"
-	"osv-detector/detector/lockfile"
+	"osv-detector/internal"
+	"osv-detector/internal/database"
+	"osv-detector/internal/lockfile"
 	"testing"
 	"time"
 )
@@ -19,7 +19,7 @@ func expectOSVDescription(t *testing.T, expected string, osv database.OSV) {
 func expectIsAffected(t *testing.T, osv database.OSV, version string, expectAffected bool) {
 	t.Helper()
 
-	pkg := detector.PackageDetails{Name: "my-package", Version: version, Ecosystem: lockfile.NpmEcosystem}
+	pkg := internal.PackageDetails{Name: "my-package", Version: version, Ecosystem: lockfile.NpmEcosystem}
 
 	if osv.IsAffected(pkg) != expectAffected {
 		if expectAffected {
@@ -312,7 +312,7 @@ func TestOSV_IsAffected_AffectsWithEcosystem_PipNamesAreNormalised(t *testing.T)
 	t.Parallel()
 
 	var osv database.OSV
-	var pkg detector.PackageDetails
+	var pkg internal.PackageDetails
 
 	osv = buildOSVWithAffected(
 		database.Affected{
@@ -326,7 +326,7 @@ func TestOSV_IsAffected_AffectsWithEcosystem_PipNamesAreNormalised(t *testing.T)
 		},
 	)
 
-	pkg = detector.PackageDetails{Name: "pillow", Version: "0.5", Ecosystem: lockfile.PipEcosystem}
+	pkg = internal.PackageDetails{Name: "pillow", Version: "0.5", Ecosystem: lockfile.PipEcosystem}
 
 	if !osv.IsAffected(pkg) {
 		t.Errorf("Expected OSV to normalize names of pip packages, but did not")
@@ -344,7 +344,7 @@ func TestOSV_IsAffected_AffectsWithEcosystem_PipNamesAreNormalised(t *testing.T)
 		},
 	)
 
-	pkg = detector.PackageDetails{Name: "pillow", Version: "0.5", Ecosystem: lockfile.NpmEcosystem}
+	pkg = internal.PackageDetails{Name: "pillow", Version: "0.5", Ecosystem: lockfile.NpmEcosystem}
 
 	if osv.IsAffected(pkg) {
 		t.Errorf("Expected OSV not to normalize names of non-pip packages, but it did")
diff --git a/detector/database/vulnerabilities_test.go b/internal/database/vulnerabilities_test.go
similarity index 98%
rename from detector/database/vulnerabilities_test.go
rename to internal/database/vulnerabilities_test.go
index 84bee60..723ae81 100644
--- a/detector/database/vulnerabilities_test.go
+++ b/internal/database/vulnerabilities_test.go
@@ -1,7 +1,7 @@
 package database_test
 
 import (
-	"osv-detector/detector/database"
+	"osv-detector/internal/database"
 	"testing"
 )
 
diff --git a/detector/lockfile/fixtures/bundler/has-local-gem.lock b/internal/lockfile/fixtures/bundler/has-local-gem.lock
similarity index 100%
rename from detector/lockfile/fixtures/bundler/has-local-gem.lock
rename to internal/lockfile/fixtures/bundler/has-local-gem.lock
diff --git a/detector/lockfile/fixtures/bundler/multiple-gems.lock b/internal/lockfile/fixtures/bundler/multiple-gems.lock
similarity index 100%
rename from detector/lockfile/fixtures/bundler/multiple-gems.lock
rename to internal/lockfile/fixtures/bundler/multiple-gems.lock
diff --git a/detector/lockfile/fixtures/bundler/no-gem-section.lock b/internal/lockfile/fixtures/bundler/no-gem-section.lock
similarity index 100%
rename from detector/lockfile/fixtures/bundler/no-gem-section.lock
rename to internal/lockfile/fixtures/bundler/no-gem-section.lock
diff --git a/detector/lockfile/fixtures/bundler/no-gems.lock b/internal/lockfile/fixtures/bundler/no-gems.lock
similarity index 100%
rename from detector/lockfile/fixtures/bundler/no-gems.lock
rename to internal/lockfile/fixtures/bundler/no-gems.lock
diff --git a/detector/lockfile/fixtures/bundler/no-spec-section.lock b/internal/lockfile/fixtures/bundler/no-spec-section.lock
similarity index 100%
rename from detector/lockfile/fixtures/bundler/no-spec-section.lock
rename to internal/lockfile/fixtures/bundler/no-spec-section.lock
diff --git a/detector/lockfile/fixtures/bundler/one-gem.lock b/internal/lockfile/fixtures/bundler/one-gem.lock
similarity index 100%
rename from detector/lockfile/fixtures/bundler/one-gem.lock
rename to internal/lockfile/fixtures/bundler/one-gem.lock
diff --git a/detector/lockfile/fixtures/bundler/rails.lock b/internal/lockfile/fixtures/bundler/rails.lock
similarity index 100%
rename from detector/lockfile/fixtures/bundler/rails.lock
rename to internal/lockfile/fixtures/bundler/rails.lock
diff --git a/detector/lockfile/fixtures/bundler/rubocop.lock b/internal/lockfile/fixtures/bundler/rubocop.lock
similarity index 100%
rename from detector/lockfile/fixtures/bundler/rubocop.lock
rename to internal/lockfile/fixtures/bundler/rubocop.lock
diff --git a/detector/lockfile/fixtures/bundler/some-gems.lock b/internal/lockfile/fixtures/bundler/some-gems.lock
similarity index 100%
rename from detector/lockfile/fixtures/bundler/some-gems.lock
rename to internal/lockfile/fixtures/bundler/some-gems.lock
diff --git a/detector/lockfile/fixtures/cargo/empty.lock b/internal/lockfile/fixtures/cargo/empty.lock
similarity index 100%
rename from detector/lockfile/fixtures/cargo/empty.lock
rename to internal/lockfile/fixtures/cargo/empty.lock
diff --git a/detector/lockfile/fixtures/cargo/not-toml.txt b/internal/lockfile/fixtures/cargo/not-toml.txt
similarity index 100%
rename from detector/lockfile/fixtures/cargo/not-toml.txt
rename to internal/lockfile/fixtures/cargo/not-toml.txt
diff --git a/detector/lockfile/fixtures/cargo/one-package.lock b/internal/lockfile/fixtures/cargo/one-package.lock
similarity index 100%
rename from detector/lockfile/fixtures/cargo/one-package.lock
rename to internal/lockfile/fixtures/cargo/one-package.lock
diff --git a/detector/lockfile/fixtures/cargo/package-with-build-string.lock b/internal/lockfile/fixtures/cargo/package-with-build-string.lock
similarity index 100%
rename from detector/lockfile/fixtures/cargo/package-with-build-string.lock
rename to internal/lockfile/fixtures/cargo/package-with-build-string.lock
diff --git a/detector/lockfile/fixtures/cargo/two-packages.lock b/internal/lockfile/fixtures/cargo/two-packages.lock
similarity index 100%
rename from detector/lockfile/fixtures/cargo/two-packages.lock
rename to internal/lockfile/fixtures/cargo/two-packages.lock
diff --git a/detector/lockfile/fixtures/composer/empty.json b/internal/lockfile/fixtures/composer/empty.json
similarity index 100%
rename from detector/lockfile/fixtures/composer/empty.json
rename to internal/lockfile/fixtures/composer/empty.json
diff --git a/detector/lockfile/fixtures/composer/not-json.txt b/internal/lockfile/fixtures/composer/not-json.txt
similarity index 100%
rename from detector/lockfile/fixtures/composer/not-json.txt
rename to internal/lockfile/fixtures/composer/not-json.txt
diff --git a/detector/lockfile/fixtures/composer/one-package-dev.json b/internal/lockfile/fixtures/composer/one-package-dev.json
similarity index 100%
rename from detector/lockfile/fixtures/composer/one-package-dev.json
rename to internal/lockfile/fixtures/composer/one-package-dev.json
diff --git a/detector/lockfile/fixtures/composer/one-package.json b/internal/lockfile/fixtures/composer/one-package.json
similarity index 100%
rename from detector/lockfile/fixtures/composer/one-package.json
rename to internal/lockfile/fixtures/composer/one-package.json
diff --git a/detector/lockfile/fixtures/composer/two-packages-alt.json b/internal/lockfile/fixtures/composer/two-packages-alt.json
similarity index 100%
rename from detector/lockfile/fixtures/composer/two-packages-alt.json
rename to internal/lockfile/fixtures/composer/two-packages-alt.json
diff --git a/detector/lockfile/fixtures/composer/two-packages.json b/internal/lockfile/fixtures/composer/two-packages.json
similarity index 100%
rename from detector/lockfile/fixtures/composer/two-packages.json
rename to internal/lockfile/fixtures/composer/two-packages.json
diff --git a/detector/lockfile/fixtures/go/empty.mod b/internal/lockfile/fixtures/go/empty.mod
similarity index 100%
rename from detector/lockfile/fixtures/go/empty.mod
rename to internal/lockfile/fixtures/go/empty.mod
diff --git a/detector/lockfile/fixtures/go/indirect-packages.mod b/internal/lockfile/fixtures/go/indirect-packages.mod
similarity index 100%
rename from detector/lockfile/fixtures/go/indirect-packages.mod
rename to internal/lockfile/fixtures/go/indirect-packages.mod
diff --git a/detector/lockfile/fixtures/go/not-go-mod.txt b/internal/lockfile/fixtures/go/not-go-mod.txt
similarity index 100%
rename from detector/lockfile/fixtures/go/not-go-mod.txt
rename to internal/lockfile/fixtures/go/not-go-mod.txt
diff --git a/detector/lockfile/fixtures/go/one-package.mod b/internal/lockfile/fixtures/go/one-package.mod
similarity index 100%
rename from detector/lockfile/fixtures/go/one-package.mod
rename to internal/lockfile/fixtures/go/one-package.mod
diff --git a/detector/lockfile/fixtures/go/two-packages.mod b/internal/lockfile/fixtures/go/two-packages.mod
similarity index 100%
rename from detector/lockfile/fixtures/go/two-packages.mod
rename to internal/lockfile/fixtures/go/two-packages.mod
diff --git a/detector/lockfile/fixtures/npm/empty.v1.json b/internal/lockfile/fixtures/npm/empty.v1.json
similarity index 100%
rename from detector/lockfile/fixtures/npm/empty.v1.json
rename to internal/lockfile/fixtures/npm/empty.v1.json
diff --git a/detector/lockfile/fixtures/npm/empty.v2.json b/internal/lockfile/fixtures/npm/empty.v2.json
similarity index 100%
rename from detector/lockfile/fixtures/npm/empty.v2.json
rename to internal/lockfile/fixtures/npm/empty.v2.json
diff --git a/detector/lockfile/fixtures/npm/nested-dependencies-dup.v1.json b/internal/lockfile/fixtures/npm/nested-dependencies-dup.v1.json
similarity index 100%
rename from detector/lockfile/fixtures/npm/nested-dependencies-dup.v1.json
rename to internal/lockfile/fixtures/npm/nested-dependencies-dup.v1.json
diff --git a/detector/lockfile/fixtures/npm/nested-dependencies-dup.v2.json b/internal/lockfile/fixtures/npm/nested-dependencies-dup.v2.json
similarity index 100%
rename from detector/lockfile/fixtures/npm/nested-dependencies-dup.v2.json
rename to internal/lockfile/fixtures/npm/nested-dependencies-dup.v2.json
diff --git a/detector/lockfile/fixtures/npm/nested-dependencies.v1.json b/internal/lockfile/fixtures/npm/nested-dependencies.v1.json
similarity index 100%
rename from detector/lockfile/fixtures/npm/nested-dependencies.v1.json
rename to internal/lockfile/fixtures/npm/nested-dependencies.v1.json
diff --git a/detector/lockfile/fixtures/npm/nested-dependencies.v2.json b/internal/lockfile/fixtures/npm/nested-dependencies.v2.json
similarity index 100%
rename from detector/lockfile/fixtures/npm/nested-dependencies.v2.json
rename to internal/lockfile/fixtures/npm/nested-dependencies.v2.json
diff --git a/detector/lockfile/fixtures/npm/not-json.txt b/internal/lockfile/fixtures/npm/not-json.txt
similarity index 100%
rename from detector/lockfile/fixtures/npm/not-json.txt
rename to internal/lockfile/fixtures/npm/not-json.txt
diff --git a/detector/lockfile/fixtures/npm/one-package-dev.v1.json b/internal/lockfile/fixtures/npm/one-package-dev.v1.json
similarity index 100%
rename from detector/lockfile/fixtures/npm/one-package-dev.v1.json
rename to internal/lockfile/fixtures/npm/one-package-dev.v1.json
diff --git a/detector/lockfile/fixtures/npm/one-package-dev.v2.json b/internal/lockfile/fixtures/npm/one-package-dev.v2.json
similarity index 100%
rename from detector/lockfile/fixtures/npm/one-package-dev.v2.json
rename to internal/lockfile/fixtures/npm/one-package-dev.v2.json
diff --git a/detector/lockfile/fixtures/npm/one-package.v1.json b/internal/lockfile/fixtures/npm/one-package.v1.json
similarity index 100%
rename from detector/lockfile/fixtures/npm/one-package.v1.json
rename to internal/lockfile/fixtures/npm/one-package.v1.json
diff --git a/detector/lockfile/fixtures/npm/one-package.v2.json b/internal/lockfile/fixtures/npm/one-package.v2.json
similarity index 100%
rename from detector/lockfile/fixtures/npm/one-package.v2.json
rename to internal/lockfile/fixtures/npm/one-package.v2.json
diff --git a/detector/lockfile/fixtures/npm/scoped-packages.v1.json b/internal/lockfile/fixtures/npm/scoped-packages.v1.json
similarity index 100%
rename from detector/lockfile/fixtures/npm/scoped-packages.v1.json
rename to internal/lockfile/fixtures/npm/scoped-packages.v1.json
diff --git a/detector/lockfile/fixtures/npm/scoped-packages.v2.json b/internal/lockfile/fixtures/npm/scoped-packages.v2.json
similarity index 100%
rename from detector/lockfile/fixtures/npm/scoped-packages.v2.json
rename to internal/lockfile/fixtures/npm/scoped-packages.v2.json
diff --git a/detector/lockfile/fixtures/npm/two-packages.v1.json b/internal/lockfile/fixtures/npm/two-packages.v1.json
similarity index 100%
rename from detector/lockfile/fixtures/npm/two-packages.v1.json
rename to internal/lockfile/fixtures/npm/two-packages.v1.json
diff --git a/detector/lockfile/fixtures/npm/two-packages.v2.json b/internal/lockfile/fixtures/npm/two-packages.v2.json
similarity index 100%
rename from detector/lockfile/fixtures/npm/two-packages.v2.json
rename to internal/lockfile/fixtures/npm/two-packages.v2.json
diff --git a/detector/lockfile/fixtures/pip/empty.txt b/internal/lockfile/fixtures/pip/empty.txt
similarity index 100%
rename from detector/lockfile/fixtures/pip/empty.txt
rename to internal/lockfile/fixtures/pip/empty.txt
diff --git a/detector/lockfile/fixtures/pip/file-format-example.txt b/internal/lockfile/fixtures/pip/file-format-example.txt
similarity index 100%
rename from detector/lockfile/fixtures/pip/file-format-example.txt
rename to internal/lockfile/fixtures/pip/file-format-example.txt
diff --git a/detector/lockfile/fixtures/pip/multiple-packages-constrained.txt b/internal/lockfile/fixtures/pip/multiple-packages-constrained.txt
similarity index 100%
rename from detector/lockfile/fixtures/pip/multiple-packages-constrained.txt
rename to internal/lockfile/fixtures/pip/multiple-packages-constrained.txt
diff --git a/detector/lockfile/fixtures/pip/multiple-packages-mixed.txt b/internal/lockfile/fixtures/pip/multiple-packages-mixed.txt
similarity index 100%
rename from detector/lockfile/fixtures/pip/multiple-packages-mixed.txt
rename to internal/lockfile/fixtures/pip/multiple-packages-mixed.txt
diff --git a/detector/lockfile/fixtures/pip/non-normalized-names.txt b/internal/lockfile/fixtures/pip/non-normalized-names.txt
similarity index 100%
rename from detector/lockfile/fixtures/pip/non-normalized-names.txt
rename to internal/lockfile/fixtures/pip/non-normalized-names.txt
diff --git a/detector/lockfile/fixtures/pip/one-package-constrained.txt b/internal/lockfile/fixtures/pip/one-package-constrained.txt
similarity index 100%
rename from detector/lockfile/fixtures/pip/one-package-constrained.txt
rename to internal/lockfile/fixtures/pip/one-package-constrained.txt
diff --git a/detector/lockfile/fixtures/pip/one-package-unconstrained.txt b/internal/lockfile/fixtures/pip/one-package-unconstrained.txt
similarity index 100%
rename from detector/lockfile/fixtures/pip/one-package-unconstrained.txt
rename to internal/lockfile/fixtures/pip/one-package-unconstrained.txt
diff --git a/detector/lockfile/fixtures/pip/only-comments.txt b/internal/lockfile/fixtures/pip/only-comments.txt
similarity index 100%
rename from detector/lockfile/fixtures/pip/only-comments.txt
rename to internal/lockfile/fixtures/pip/only-comments.txt
diff --git a/detector/lockfile/fixtures/pip/with-added-support.txt b/internal/lockfile/fixtures/pip/with-added-support.txt
similarity index 100%
rename from detector/lockfile/fixtures/pip/with-added-support.txt
rename to internal/lockfile/fixtures/pip/with-added-support.txt
diff --git a/detector/lockfile/fixtures/pnpm/empty.yaml b/internal/lockfile/fixtures/pnpm/empty.yaml
similarity index 100%
rename from detector/lockfile/fixtures/pnpm/empty.yaml
rename to internal/lockfile/fixtures/pnpm/empty.yaml
diff --git a/detector/lockfile/fixtures/pnpm/exotic.yaml b/internal/lockfile/fixtures/pnpm/exotic.yaml
similarity index 100%
rename from detector/lockfile/fixtures/pnpm/exotic.yaml
rename to internal/lockfile/fixtures/pnpm/exotic.yaml
diff --git a/detector/lockfile/fixtures/pnpm/multiple-packages.yaml b/internal/lockfile/fixtures/pnpm/multiple-packages.yaml
similarity index 100%
rename from detector/lockfile/fixtures/pnpm/multiple-packages.yaml
rename to internal/lockfile/fixtures/pnpm/multiple-packages.yaml
diff --git a/detector/lockfile/fixtures/pnpm/multiple-versions.yaml b/internal/lockfile/fixtures/pnpm/multiple-versions.yaml
similarity index 100%
rename from detector/lockfile/fixtures/pnpm/multiple-versions.yaml
rename to internal/lockfile/fixtures/pnpm/multiple-versions.yaml
diff --git a/detector/lockfile/fixtures/pnpm/not-yaml.txt b/internal/lockfile/fixtures/pnpm/not-yaml.txt
similarity index 100%
rename from detector/lockfile/fixtures/pnpm/not-yaml.txt
rename to internal/lockfile/fixtures/pnpm/not-yaml.txt
diff --git a/detector/lockfile/fixtures/pnpm/one-package-dev.yaml b/internal/lockfile/fixtures/pnpm/one-package-dev.yaml
similarity index 100%
rename from detector/lockfile/fixtures/pnpm/one-package-dev.yaml
rename to internal/lockfile/fixtures/pnpm/one-package-dev.yaml
diff --git a/detector/lockfile/fixtures/pnpm/one-package.yaml b/internal/lockfile/fixtures/pnpm/one-package.yaml
similarity index 100%
rename from detector/lockfile/fixtures/pnpm/one-package.yaml
rename to internal/lockfile/fixtures/pnpm/one-package.yaml
diff --git a/detector/lockfile/fixtures/pnpm/peer-dependencies-advanced.yaml b/internal/lockfile/fixtures/pnpm/peer-dependencies-advanced.yaml
similarity index 100%
rename from detector/lockfile/fixtures/pnpm/peer-dependencies-advanced.yaml
rename to internal/lockfile/fixtures/pnpm/peer-dependencies-advanced.yaml
diff --git a/detector/lockfile/fixtures/pnpm/peer-dependencies.yaml b/internal/lockfile/fixtures/pnpm/peer-dependencies.yaml
similarity index 100%
rename from detector/lockfile/fixtures/pnpm/peer-dependencies.yaml
rename to internal/lockfile/fixtures/pnpm/peer-dependencies.yaml
diff --git a/detector/lockfile/fixtures/pnpm/scoped-packages.yaml b/internal/lockfile/fixtures/pnpm/scoped-packages.yaml
similarity index 100%
rename from detector/lockfile/fixtures/pnpm/scoped-packages.yaml
rename to internal/lockfile/fixtures/pnpm/scoped-packages.yaml
diff --git a/detector/lockfile/fixtures/yarn/empty.v1.lock b/internal/lockfile/fixtures/yarn/empty.v1.lock
similarity index 100%
rename from detector/lockfile/fixtures/yarn/empty.v1.lock
rename to internal/lockfile/fixtures/yarn/empty.v1.lock
diff --git a/detector/lockfile/fixtures/yarn/empty.v2.lock b/internal/lockfile/fixtures/yarn/empty.v2.lock
similarity index 100%
rename from detector/lockfile/fixtures/yarn/empty.v2.lock
rename to internal/lockfile/fixtures/yarn/empty.v2.lock
diff --git a/detector/lockfile/fixtures/yarn/metadata-only.v2.lock b/internal/lockfile/fixtures/yarn/metadata-only.v2.lock
similarity index 100%
rename from detector/lockfile/fixtures/yarn/metadata-only.v2.lock
rename to internal/lockfile/fixtures/yarn/metadata-only.v2.lock
diff --git a/detector/lockfile/fixtures/yarn/multiple-constraints.v1.lock b/internal/lockfile/fixtures/yarn/multiple-constraints.v1.lock
similarity index 100%
rename from detector/lockfile/fixtures/yarn/multiple-constraints.v1.lock
rename to internal/lockfile/fixtures/yarn/multiple-constraints.v1.lock
diff --git a/detector/lockfile/fixtures/yarn/multiple-versions.v1.lock b/internal/lockfile/fixtures/yarn/multiple-versions.v1.lock
similarity index 100%
rename from detector/lockfile/fixtures/yarn/multiple-versions.v1.lock
rename to internal/lockfile/fixtures/yarn/multiple-versions.v1.lock
diff --git a/detector/lockfile/fixtures/yarn/multiple-versions.v2.lock b/internal/lockfile/fixtures/yarn/multiple-versions.v2.lock
similarity index 100%
rename from detector/lockfile/fixtures/yarn/multiple-versions.v2.lock
rename to internal/lockfile/fixtures/yarn/multiple-versions.v2.lock
diff --git a/detector/lockfile/fixtures/yarn/one-package.v1.lock b/internal/lockfile/fixtures/yarn/one-package.v1.lock
similarity index 100%
rename from detector/lockfile/fixtures/yarn/one-package.v1.lock
rename to internal/lockfile/fixtures/yarn/one-package.v1.lock
diff --git a/detector/lockfile/fixtures/yarn/one-package.v2.lock b/internal/lockfile/fixtures/yarn/one-package.v2.lock
similarity index 100%
rename from detector/lockfile/fixtures/yarn/one-package.v2.lock
rename to internal/lockfile/fixtures/yarn/one-package.v2.lock
diff --git a/detector/lockfile/fixtures/yarn/scoped-packages.v1.lock b/internal/lockfile/fixtures/yarn/scoped-packages.v1.lock
similarity index 100%
rename from detector/lockfile/fixtures/yarn/scoped-packages.v1.lock
rename to internal/lockfile/fixtures/yarn/scoped-packages.v1.lock
diff --git a/detector/lockfile/fixtures/yarn/scoped-packages.v2.lock b/internal/lockfile/fixtures/yarn/scoped-packages.v2.lock
similarity index 100%
rename from detector/lockfile/fixtures/yarn/scoped-packages.v2.lock
rename to internal/lockfile/fixtures/yarn/scoped-packages.v2.lock
diff --git a/detector/lockfile/fixtures/yarn/two-packages.v1.lock b/internal/lockfile/fixtures/yarn/two-packages.v1.lock
similarity index 100%
rename from detector/lockfile/fixtures/yarn/two-packages.v1.lock
rename to internal/lockfile/fixtures/yarn/two-packages.v1.lock
diff --git a/detector/lockfile/fixtures/yarn/two-packages.v2.lock b/internal/lockfile/fixtures/yarn/two-packages.v2.lock
similarity index 100%
rename from detector/lockfile/fixtures/yarn/two-packages.v2.lock
rename to internal/lockfile/fixtures/yarn/two-packages.v2.lock
diff --git a/detector/lockfile/fixtures/yarn/versions-with-build-strings.v1.lock b/internal/lockfile/fixtures/yarn/versions-with-build-strings.v1.lock
similarity index 100%
rename from detector/lockfile/fixtures/yarn/versions-with-build-strings.v1.lock
rename to internal/lockfile/fixtures/yarn/versions-with-build-strings.v1.lock
diff --git a/detector/lockfile/fixtures/yarn/versions-with-build-strings.v2.lock b/internal/lockfile/fixtures/yarn/versions-with-build-strings.v2.lock
similarity index 100%
rename from detector/lockfile/fixtures/yarn/versions-with-build-strings.v2.lock
rename to internal/lockfile/fixtures/yarn/versions-with-build-strings.v2.lock
diff --git a/detector/lockfile/helpers_test.go b/internal/lockfile/helpers_test.go
similarity index 98%
rename from detector/lockfile/helpers_test.go
rename to internal/lockfile/helpers_test.go
index 52a38ba..3ee8f8f 100644
--- a/detector/lockfile/helpers_test.go
+++ b/internal/lockfile/helpers_test.go
@@ -2,7 +2,7 @@ package lockfile_test
 
 import (
 	"fmt"
-	"osv-detector/detector/lockfile"
+	"osv-detector/internal/lockfile"
 	"strings"
 	"testing"
 )
diff --git a/detector/lockfile/parse-cargo-lock.go b/internal/lockfile/parse-cargo-lock.go
similarity index 100%
rename from detector/lockfile/parse-cargo-lock.go
rename to internal/lockfile/parse-cargo-lock.go
diff --git a/detector/lockfile/parse-cargo-lock_test.go b/internal/lockfile/parse-cargo-lock_test.go
similarity index 98%
rename from detector/lockfile/parse-cargo-lock_test.go
rename to internal/lockfile/parse-cargo-lock_test.go
index 88725c6..d18a4b2 100644
--- a/detector/lockfile/parse-cargo-lock_test.go
+++ b/internal/lockfile/parse-cargo-lock_test.go
@@ -1,7 +1,7 @@
 package lockfile_test
 
 import (
-	"osv-detector/detector/lockfile"
+	"osv-detector/internal/lockfile"
 	"testing"
 )
 
diff --git a/detector/lockfile/parse-composer-lock.go b/internal/lockfile/parse-composer-lock.go
similarity index 100%
rename from detector/lockfile/parse-composer-lock.go
rename to internal/lockfile/parse-composer-lock.go
diff --git a/detector/lockfile/parse-composer-lock_test.go b/internal/lockfile/parse-composer-lock_test.go
similarity index 98%
rename from detector/lockfile/parse-composer-lock_test.go
rename to internal/lockfile/parse-composer-lock_test.go
index 49c4cd1..2428493 100644
--- a/detector/lockfile/parse-composer-lock_test.go
+++ b/internal/lockfile/parse-composer-lock_test.go
@@ -1,7 +1,7 @@
 package lockfile_test
 
 import (
-	"osv-detector/detector/lockfile"
+	"osv-detector/internal/lockfile"
 	"testing"
 )
 
diff --git a/detector/lockfile/parse-gemfile-lock.go b/internal/lockfile/parse-gemfile-lock.go
similarity index 100%
rename from detector/lockfile/parse-gemfile-lock.go
rename to internal/lockfile/parse-gemfile-lock.go
diff --git a/detector/lockfile/parse-gemfile-lock_test.go b/internal/lockfile/parse-gemfile-lock_test.go
similarity index 99%
rename from detector/lockfile/parse-gemfile-lock_test.go
rename to internal/lockfile/parse-gemfile-lock_test.go
index c6ac94d..0e79054 100644
--- a/detector/lockfile/parse-gemfile-lock_test.go
+++ b/internal/lockfile/parse-gemfile-lock_test.go
@@ -1,7 +1,7 @@
 package lockfile_test
 
 import (
-	"osv-detector/detector/lockfile"
+	"osv-detector/internal/lockfile"
 	"testing"
 )
 
diff --git a/detector/lockfile/parse-go-lock.go b/internal/lockfile/parse-go-lock.go
similarity index 100%
rename from detector/lockfile/parse-go-lock.go
rename to internal/lockfile/parse-go-lock.go
diff --git a/detector/lockfile/parse-go-lock_test.go b/internal/lockfile/parse-go-lock_test.go
similarity index 98%
rename from detector/lockfile/parse-go-lock_test.go
rename to internal/lockfile/parse-go-lock_test.go
index d5b7af4..f3f6717 100644
--- a/detector/lockfile/parse-go-lock_test.go
+++ b/internal/lockfile/parse-go-lock_test.go
@@ -1,7 +1,7 @@
 package lockfile_test
 
 import (
-	"osv-detector/detector/lockfile"
+	"osv-detector/internal/lockfile"
 	"testing"
 )
 
diff --git a/detector/lockfile/parse-npm-lock-v1_test.go b/internal/lockfile/parse-npm-lock-v1_test.go
similarity index 99%
rename from detector/lockfile/parse-npm-lock-v1_test.go
rename to internal/lockfile/parse-npm-lock-v1_test.go
index 3115516..8b9fa0c 100644
--- a/detector/lockfile/parse-npm-lock-v1_test.go
+++ b/internal/lockfile/parse-npm-lock-v1_test.go
@@ -1,7 +1,7 @@
 package lockfile_test
 
 import (
-	"osv-detector/detector/lockfile"
+	"osv-detector/internal/lockfile"
 	"testing"
 )
 
diff --git a/detector/lockfile/parse-npm-lock-v2_test.go b/internal/lockfile/parse-npm-lock-v2_test.go
similarity index 99%
rename from detector/lockfile/parse-npm-lock-v2_test.go
rename to internal/lockfile/parse-npm-lock-v2_test.go
index 1d400da..4d33427 100644
--- a/detector/lockfile/parse-npm-lock-v2_test.go
+++ b/internal/lockfile/parse-npm-lock-v2_test.go
@@ -1,7 +1,7 @@
 package lockfile_test
 
 import (
-	"osv-detector/detector/lockfile"
+	"osv-detector/internal/lockfile"
 	"testing"
 )
 
diff --git a/detector/lockfile/parse-npm-lock.go b/internal/lockfile/parse-npm-lock.go
similarity index 100%
rename from detector/lockfile/parse-npm-lock.go
rename to internal/lockfile/parse-npm-lock.go
diff --git a/detector/lockfile/parse-pnpm-lock.go b/internal/lockfile/parse-pnpm-lock.go
similarity index 100%
rename from detector/lockfile/parse-pnpm-lock.go
rename to internal/lockfile/parse-pnpm-lock.go
diff --git a/detector/lockfile/parse-pnpm-lock_test.go b/internal/lockfile/parse-pnpm-lock_test.go
similarity index 99%
rename from detector/lockfile/parse-pnpm-lock_test.go
rename to internal/lockfile/parse-pnpm-lock_test.go
index 7e251b7..5f8584d 100644
--- a/detector/lockfile/parse-pnpm-lock_test.go
+++ b/internal/lockfile/parse-pnpm-lock_test.go
@@ -1,7 +1,7 @@
 package lockfile_test
 
 import (
-	"osv-detector/detector/lockfile"
+	"osv-detector/internal/lockfile"
 	"testing"
 )
 
diff --git a/detector/lockfile/parse-requirements-txt.go b/internal/lockfile/parse-requirements-txt.go
similarity index 100%
rename from detector/lockfile/parse-requirements-txt.go
rename to internal/lockfile/parse-requirements-txt.go
diff --git a/detector/lockfile/parse-requirements-txt_test.go b/internal/lockfile/parse-requirements-txt_test.go
similarity index 99%
rename from detector/lockfile/parse-requirements-txt_test.go
rename to internal/lockfile/parse-requirements-txt_test.go
index 50688d3..d1d6b3a 100644
--- a/detector/lockfile/parse-requirements-txt_test.go
+++ b/internal/lockfile/parse-requirements-txt_test.go
@@ -1,7 +1,7 @@
 package lockfile_test
 
 import (
-	"osv-detector/detector/lockfile"
+	"osv-detector/internal/lockfile"
 	"testing"
 )
 
diff --git a/detector/lockfile/parse-yarn-lock-v1_test.go b/internal/lockfile/parse-yarn-lock-v1_test.go
similarity index 99%
rename from detector/lockfile/parse-yarn-lock-v1_test.go
rename to internal/lockfile/parse-yarn-lock-v1_test.go
index c5039d1..08705f4 100644
--- a/detector/lockfile/parse-yarn-lock-v1_test.go
+++ b/internal/lockfile/parse-yarn-lock-v1_test.go
@@ -1,7 +1,7 @@
 package lockfile_test
 
 import (
-	"osv-detector/detector/lockfile"
+	"osv-detector/internal/lockfile"
 	"testing"
 )
 
diff --git a/detector/lockfile/parse-yarn-lock-v2_test.go b/internal/lockfile/parse-yarn-lock-v2_test.go
similarity index 98%
rename from detector/lockfile/parse-yarn-lock-v2_test.go
rename to internal/lockfile/parse-yarn-lock-v2_test.go
index dff507c..51f59bf 100644
--- a/detector/lockfile/parse-yarn-lock-v2_test.go
+++ b/internal/lockfile/parse-yarn-lock-v2_test.go
@@ -1,7 +1,7 @@
 package lockfile_test
 
 import (
-	"osv-detector/detector/lockfile"
+	"osv-detector/internal/lockfile"
 	"testing"
 )
 
diff --git a/detector/lockfile/parse-yarn-lock.go b/internal/lockfile/parse-yarn-lock.go
similarity index 100%
rename from detector/lockfile/parse-yarn-lock.go
rename to internal/lockfile/parse-yarn-lock.go
diff --git a/detector/lockfile/parsers.go b/internal/lockfile/parsers.go
similarity index 100%
rename from detector/lockfile/parsers.go
rename to internal/lockfile/parsers.go
diff --git a/detector/lockfile/parsers_test.go b/internal/lockfile/parsers_test.go
similarity index 97%
rename from detector/lockfile/parsers_test.go
rename to internal/lockfile/parsers_test.go
index 797b15f..df637ed 100644
--- a/detector/lockfile/parsers_test.go
+++ b/internal/lockfile/parsers_test.go
@@ -3,7 +3,7 @@ package lockfile_test
 import (
 	"errors"
 	"io/ioutil"
-	"osv-detector/detector/lockfile"
+	"osv-detector/internal/lockfile"
 	"strings"
 	"testing"
 )
diff --git a/detector/semantic/compare.go b/internal/semantic/compare.go
similarity index 100%
rename from detector/semantic/compare.go
rename to internal/semantic/compare.go
diff --git a/detector/semantic/compare_test.go b/internal/semantic/compare_test.go
similarity index 99%
rename from detector/semantic/compare_test.go
rename to internal/semantic/compare_test.go
index 8426307..0aa2a63 100644
--- a/detector/semantic/compare_test.go
+++ b/internal/semantic/compare_test.go
@@ -1,7 +1,7 @@
 package semantic_test
 
 import (
-	"osv-detector/detector/semantic"
+	"osv-detector/internal/semantic"
 	"testing"
 )
 
diff --git a/detector/semantic/fixtures/all-versions.txt b/internal/semantic/fixtures/all-versions.txt
similarity index 100%
rename from detector/semantic/fixtures/all-versions.txt
rename to internal/semantic/fixtures/all-versions.txt
diff --git a/detector/semantic/parse.go b/internal/semantic/parse.go
similarity index 100%
rename from detector/semantic/parse.go
rename to internal/semantic/parse.go
diff --git a/detector/semantic/parse_test.go b/internal/semantic/parse_test.go
similarity index 99%
rename from detector/semantic/parse_test.go
rename to internal/semantic/parse_test.go
index 2b8c0ea..e66d108 100644
--- a/detector/semantic/parse_test.go
+++ b/internal/semantic/parse_test.go
@@ -4,7 +4,7 @@ import (
 	"bufio"
 	"fmt"
 	"os"
-	"osv-detector/detector/semantic"
+	"osv-detector/internal/semantic"
 	"strings"
 	"testing"
 )