From 1e67593efc686763ea85b9ff550f96a123734fe1 Mon Sep 17 00:00:00 2001 From: viktigpetterr Date: Tue, 16 May 2023 16:30:10 +0200 Subject: [PATCH] Move resolution package to internal/ --- .gitignore | 4 +- cmd/debricked/main.go | 4 +- internal/client/deb_client_test.go | 2 +- internal/cmd/files/files.go | 4 +- internal/cmd/files/files_test.go | 2 +- internal/cmd/report/report.go | 8 +-- internal/cmd/report/report_test.go | 4 +- {pkg => internal}/cmd/resolve/resolve.go | 4 +- {pkg => internal}/cmd/resolve/resolve_test.go | 8 +-- internal/cmd/root/root.go | 10 +-- internal/cmd/root/root_test.go | 2 +- internal/cmd/scan/scan.go | 4 +- internal/cmd/scan/scan_test.go | 2 +- .../cmd}/scan/testdata/npm/package.json | 0 .../resolution/file/file_batch.go | 2 +- .../resolution/file/file_batch_factory.go | 2 +- .../file/file_batch_factory_test.go | 4 +- .../resolution/file/file_batch_test.go | 2 +- .../file/testdata/file_batch_factory_mock.go | 4 +- .../file/testdata/file_batch_mock.go | 0 {pkg => internal}/resolution/job/base_job.go | 0 .../resolution/job/base_job_test.go | 0 {pkg => internal}/resolution/job/error.go | 0 {pkg => internal}/resolution/job/errors.go | 0 .../resolution/job/errors_test.go | 0 {pkg => internal}/resolution/job/job.go | 0 .../resolution/job/testdata/job_mock.go | 2 +- .../resolution/job/testdata/job_test_util.go | 2 +- .../resolution/pm/gomod/cmd_factory.go | 0 .../resolution/pm/gomod/cmd_factory_test.go | 0 {pkg => internal}/resolution/pm/gomod/job.go | 6 +- .../resolution/pm/gomod/job_test.go | 8 +-- {pkg => internal}/resolution/pm/gomod/pm.go | 0 .../resolution/pm/gomod/pm_test.go | 0 .../resolution/pm/gomod/strategy.go | 4 +- .../resolution/pm/gomod/strategy_test.go | 0 .../pm/gomod/testdata/cmd_factory_mock.go | 0 .../resolution/pm/gradle/cmd_factory.go | 0 .../resolution/pm/gradle/cmd_factory_test.go | 0 .../gradle-init/gradle-init-script.groovy | 0 .../pm/gradle/init_script_handler.go | 2 +- .../pm/gradle/init_script_handler_test.go | 2 +- {pkg => internal}/resolution/pm/gradle/job.go | 4 +- .../resolution/pm/gradle/job_test.go | 8 +-- .../resolution/pm/gradle/meta_file_finder.go | 0 .../pm/gradle/meta_file_finder_test.go | 0 {pkg => internal}/resolution/pm/gradle/pm.go | 0 .../resolution/pm/gradle/pm_test.go | 0 .../resolution/pm/gradle/project.go | 0 .../resolution/pm/gradle/setup.go | 2 +- .../resolution/pm/gradle/setup_err.go | 0 .../resolution/pm/gradle/setup_test.go | 4 +- .../resolution/pm/gradle/strategy.go | 4 +- .../resolution/pm/gradle/strategy_test.go | 0 .../pm/gradle/testdata/cmd_factory_mock.go | 0 .../pm/gradle/testdata/project/build.gradle | 0 .../pm/gradle/testdata/project/gradlew | 0 .../pm/gradle/testdata/project/gradlew.bat | 0 .../gradle/testdata/project/settings.gradle | 0 .../testdata/project/subproject/build.gradle | 0 .../resolution/pm/maven/cmd_factory.go | 0 .../resolution/pm/maven/cmd_factory_test.go | 0 {pkg => internal}/resolution/pm/maven/job.go | 2 +- .../resolution/pm/maven/job_test.go | 4 +- {pkg => internal}/resolution/pm/maven/pm.go | 0 .../resolution/pm/maven/pm_test.go | 0 .../resolution/pm/maven/pom_service.go | 0 .../resolution/pm/maven/pom_service_test.go | 0 .../resolution/pm/maven/strategy.go | 2 +- .../resolution/pm/maven/strategy_test.go | 0 .../pm/maven/testdata/cmd_factory_mock.go | 0 .../pm/maven/testdata/guava/pom.xml | 0 .../resolution/pm/maven/testdata/notAPom.xml | 0 .../resolution/pm/maven/testdata/pom.xml | 0 .../resolution/pm/pip/cmd_factory.go | 0 .../resolution/pm/pip/cmd_factory_test.go | 0 {pkg => internal}/resolution/pm/pip/job.go | 6 +- .../resolution/pm/pip/job_test.go | 8 +-- {pkg => internal}/resolution/pm/pip/pm.go | 0 .../resolution/pm/pip/pm_test.go | 0 .../resolution/pm/pip/strategy.go | 4 +- .../resolution/pm/pip/strategy_test.go | 0 .../pm/pip/testdata/cmd_factory_mock.go | 0 .../resolution/pm/pip/testdata/list.txt | 0 .../pm/pip/testdata/requirements.txt | 0 .../resolution/pm/pip/testdata/show.txt | 0 internal/resolution/pm/pm.go | 22 ++++++ {pkg => internal}/resolution/pm/pm_test.go | 0 .../resolution/pm/testdata/pm_mock.go | 0 {pkg => internal}/resolution/pm/util/util.go | 4 +- .../resolution/pm/util/util_test.go | 6 +- .../resolution/pm/writer/file_writer.go | 0 .../resolution/pm/writer/file_writer_test.go | 0 .../pm/writer/testdata/file_writer_mock.go | 0 {pkg => internal}/resolution/resolution.go | 2 +- .../resolution/resolution_test.go | 4 +- {pkg => internal}/resolution/resolver.go | 12 ++-- {pkg => internal}/resolution/resolver_test.go | 24 +++---- {pkg => internal}/resolution/scheduler.go | 4 +- .../resolution/scheduler_test.go | 4 +- .../resolution/strategy/strategy.go | 2 +- .../resolution/strategy/strategy_factory.go | 10 +-- .../strategy/strategy_factory_test.go | 12 ++-- .../strategy/testdata/strategy_mock.go | 4 +- .../testdata/strategy_mock_factory.go | 4 +- .../resolution/testdata/resolver_mock.go | 4 +- internal/scan/scanner.go | 16 ++--- internal/scan/scanner_test.go | 68 ++++++++++--------- .../scan/testdata/{yarn => npm}/package.json | 0 internal/scan/testdata/yarn/yarn.lock | 8 --- internal/tui/resolution_error_list.go | 2 +- internal/tui/resolution_error_list_test.go | 4 +- internal/upload/batch.go | 8 +-- internal/upload/uploader_test.go | 12 ++-- {pkg => internal}/wire/cli_container.go | 20 +++--- {pkg => internal}/wire/cli_container_test.go | 0 {pkg => internal}/wire/container.go | 0 pkg/resolution/pm/pm.go | 22 ------ scripts/test_cli.sh | 2 +- test/resolve/pip_test.go | 4 +- 120 files changed, 212 insertions(+), 218 deletions(-) rename {pkg => internal}/cmd/resolve/resolve.go (95%) rename {pkg => internal}/cmd/resolve/resolve_test.go (90%) rename {pkg => internal/cmd}/scan/testdata/npm/package.json (100%) rename {pkg => internal}/resolution/file/file_batch.go (89%) rename {pkg => internal}/resolution/file/file_batch_factory.go (94%) rename {pkg => internal}/resolution/file/file_batch_factory_test.go (95%) rename {pkg => internal}/resolution/file/file_batch_test.go (93%) rename {pkg => internal}/resolution/file/testdata/file_batch_factory_mock.go (71%) rename {pkg => internal}/resolution/file/testdata/file_batch_mock.go (100%) rename {pkg => internal}/resolution/job/base_job.go (100%) rename {pkg => internal}/resolution/job/base_job_test.go (100%) rename {pkg => internal}/resolution/job/error.go (100%) rename {pkg => internal}/resolution/job/errors.go (100%) rename {pkg => internal}/resolution/job/errors_test.go (100%) rename {pkg => internal}/resolution/job/job.go (100%) rename {pkg => internal}/resolution/job/testdata/job_mock.go (91%) rename {pkg => internal}/resolution/job/testdata/job_test_util.go (90%) rename {pkg => internal}/resolution/pm/gomod/cmd_factory.go (100%) rename {pkg => internal}/resolution/pm/gomod/cmd_factory_test.go (100%) rename {pkg => internal}/resolution/pm/gomod/job.go (91%) rename {pkg => internal}/resolution/pm/gomod/job_test.go (91%) rename {pkg => internal}/resolution/pm/gomod/pm.go (100%) rename {pkg => internal}/resolution/pm/gomod/pm_test.go (100%) rename {pkg => internal}/resolution/pm/gomod/strategy.go (75%) rename {pkg => internal}/resolution/pm/gomod/strategy_test.go (100%) rename {pkg => internal}/resolution/pm/gomod/testdata/cmd_factory_mock.go (100%) rename {pkg => internal}/resolution/pm/gradle/cmd_factory.go (100%) rename {pkg => internal}/resolution/pm/gradle/cmd_factory_test.go (100%) rename {pkg => internal}/resolution/pm/gradle/gradle-init/gradle-init-script.groovy (100%) rename {pkg => internal}/resolution/pm/gradle/init_script_handler.go (93%) rename {pkg => internal}/resolution/pm/gradle/init_script_handler_test.go (92%) rename {pkg => internal}/resolution/pm/gradle/job.go (93%) rename {pkg => internal}/resolution/pm/gradle/job_test.go (93%) rename {pkg => internal}/resolution/pm/gradle/meta_file_finder.go (100%) rename {pkg => internal}/resolution/pm/gradle/meta_file_finder_test.go (100%) rename {pkg => internal}/resolution/pm/gradle/pm.go (100%) rename {pkg => internal}/resolution/pm/gradle/pm_test.go (100%) rename {pkg => internal}/resolution/pm/gradle/project.go (100%) rename {pkg => internal}/resolution/pm/gradle/setup.go (98%) rename {pkg => internal}/resolution/pm/gradle/setup_err.go (100%) rename {pkg => internal}/resolution/pm/gradle/setup_test.go (97%) rename {pkg => internal}/resolution/pm/gradle/strategy.go (93%) rename {pkg => internal}/resolution/pm/gradle/strategy_test.go (100%) rename {pkg => internal}/resolution/pm/gradle/testdata/cmd_factory_mock.go (100%) rename {pkg => internal}/resolution/pm/gradle/testdata/project/build.gradle (100%) rename {pkg => internal}/resolution/pm/gradle/testdata/project/gradlew (100%) rename {pkg => internal}/resolution/pm/gradle/testdata/project/gradlew.bat (100%) rename {pkg => internal}/resolution/pm/gradle/testdata/project/settings.gradle (100%) rename {pkg => internal}/resolution/pm/gradle/testdata/project/subproject/build.gradle (100%) rename {pkg => internal}/resolution/pm/maven/cmd_factory.go (100%) rename {pkg => internal}/resolution/pm/maven/cmd_factory_test.go (100%) rename {pkg => internal}/resolution/pm/maven/job.go (92%) rename {pkg => internal}/resolution/pm/maven/job_test.go (90%) rename {pkg => internal}/resolution/pm/maven/pm.go (100%) rename {pkg => internal}/resolution/pm/maven/pm_test.go (100%) rename {pkg => internal}/resolution/pm/maven/pom_service.go (100%) rename {pkg => internal}/resolution/pm/maven/pom_service_test.go (100%) rename {pkg => internal}/resolution/pm/maven/strategy.go (89%) rename {pkg => internal}/resolution/pm/maven/strategy_test.go (100%) rename {pkg => internal}/resolution/pm/maven/testdata/cmd_factory_mock.go (100%) rename {pkg => internal}/resolution/pm/maven/testdata/guava/pom.xml (100%) rename {pkg => internal}/resolution/pm/maven/testdata/notAPom.xml (100%) rename {pkg => internal}/resolution/pm/maven/testdata/pom.xml (100%) rename {pkg => internal}/resolution/pm/pip/cmd_factory.go (100%) rename {pkg => internal}/resolution/pm/pip/cmd_factory_test.go (100%) rename {pkg => internal}/resolution/pm/pip/job.go (96%) rename {pkg => internal}/resolution/pm/pip/job_test.go (96%) rename {pkg => internal}/resolution/pm/pip/pm.go (100%) rename {pkg => internal}/resolution/pm/pip/pm_test.go (100%) rename {pkg => internal}/resolution/pm/pip/strategy.go (78%) rename {pkg => internal}/resolution/pm/pip/strategy_test.go (100%) rename {pkg => internal}/resolution/pm/pip/testdata/cmd_factory_mock.go (100%) rename {pkg => internal}/resolution/pm/pip/testdata/list.txt (100%) rename {pkg => internal}/resolution/pm/pip/testdata/requirements.txt (100%) rename {pkg => internal}/resolution/pm/pip/testdata/show.txt (100%) create mode 100644 internal/resolution/pm/pm.go rename {pkg => internal}/resolution/pm/pm_test.go (100%) rename {pkg => internal}/resolution/pm/testdata/pm_mock.go (100%) rename {pkg => internal}/resolution/pm/util/util.go (82%) rename {pkg => internal}/resolution/pm/util/util_test.go (87%) rename {pkg => internal}/resolution/pm/writer/file_writer.go (100%) rename {pkg => internal}/resolution/pm/writer/file_writer_test.go (100%) rename {pkg => internal}/resolution/pm/writer/testdata/file_writer_mock.go (100%) rename {pkg => internal}/resolution/resolution.go (87%) rename {pkg => internal}/resolution/resolution_test.go (90%) rename {pkg => internal}/resolution/resolver.go (88%) rename {pkg => internal}/resolution/resolver_test.go (87%) rename {pkg => internal}/resolution/scheduler.go (95%) rename {pkg => internal}/resolution/scheduler_test.go (93%) rename {pkg => internal}/resolution/strategy/strategy.go (63%) rename {pkg => internal}/resolution/strategy/strategy_factory.go (71%) rename {pkg => internal}/resolution/strategy/strategy_factory_test.go (72%) rename {pkg => internal}/resolution/strategy/testdata/strategy_mock.go (84%) rename {pkg => internal}/resolution/strategy/testdata/strategy_mock_factory.go (83%) rename {pkg => internal}/resolution/testdata/resolver_mock.go (87%) rename internal/scan/testdata/{yarn => npm}/package.json (100%) delete mode 100644 internal/scan/testdata/yarn/yarn.lock rename {pkg => internal}/wire/cli_container.go (82%) rename {pkg => internal}/wire/cli_container_test.go (100%) rename {pkg => internal}/wire/container.go (100%) delete mode 100644 pkg/resolution/pm/pm.go diff --git a/.gitignore b/.gitignore index 2b8ea1be..bf400b98 100644 --- a/.gitignore +++ b/.gitignore @@ -9,5 +9,5 @@ dist/ /.env test/resolve/testdata/pip/requirements.txt.venv/ test/resolve/testdata/pip/.requirements.txt.debricked.lock -pkg/scan/testdata/npm/yarn.lock -pkg/resolution/pm/gradle/.gradle-init-script.debricked.groovy +internal/cmd/scan/testdata/npm/yarn.lock +internal/resolution/pm/gradle/.gradle-init-script.debricked.groovy diff --git a/cmd/debricked/main.go b/cmd/debricked/main.go index 3befa613..6343e8d0 100644 --- a/cmd/debricked/main.go +++ b/cmd/debricked/main.go @@ -3,8 +3,8 @@ package main import ( "os" - "github.com/debricked/cli/pkg/cmd/root" - "github.com/debricked/cli/pkg/wire" + "github.com/debricked/cli/internal/cmd/root" + "github.com/debricked/cli/internal/wire" ) var version string // Set at compile time diff --git a/internal/client/deb_client_test.go b/internal/client/deb_client_test.go index 6c39b86a..e2033d62 100644 --- a/internal/client/deb_client_test.go +++ b/internal/client/deb_client_test.go @@ -10,8 +10,8 @@ import ( "strings" "testing" - "github.com/stretchr/testify/assert" testdataClient "github.com/debricked/cli/internal/client/testdata/client" + "github.com/stretchr/testify/assert" ) var client *DebClient diff --git a/internal/cmd/files/files.go b/internal/cmd/files/files.go index 227e2612..34627f19 100644 --- a/internal/cmd/files/files.go +++ b/internal/cmd/files/files.go @@ -1,8 +1,8 @@ package files import ( - "github.com/debricked/cli/pkg/cmd/files/find" - "github.com/debricked/cli/pkg/file" + "github.com/debricked/cli/internal/cmd/files/find" + "github.com/debricked/cli/internal/file" "github.com/spf13/cobra" "github.com/spf13/viper" ) diff --git a/internal/cmd/files/files_test.go b/internal/cmd/files/files_test.go index 29418be7..eb3ff5a3 100644 --- a/internal/cmd/files/files_test.go +++ b/internal/cmd/files/files_test.go @@ -3,7 +3,7 @@ package files import ( "testing" - "github.com/debricked/cli/pkg/file" + "github.com/debricked/cli/internal/file" "github.com/stretchr/testify/assert" ) diff --git a/internal/cmd/report/report.go b/internal/cmd/report/report.go index 8d6b82b5..60bcb458 100644 --- a/internal/cmd/report/report.go +++ b/internal/cmd/report/report.go @@ -1,10 +1,10 @@ package report import ( - "github.com/debricked/cli/pkg/cmd/report/license" - "github.com/debricked/cli/pkg/cmd/report/vulnerability" - licenseReport "github.com/debricked/cli/pkg/report/license" - vulnerabilityReport "github.com/debricked/cli/pkg/report/vulnerability" + "github.com/debricked/cli/internal/cmd/report/license" + "github.com/debricked/cli/internal/cmd/report/vulnerability" + licenseReport "github.com/debricked/cli/internal/report/license" + vulnerabilityReport "github.com/debricked/cli/internal/report/vulnerability" "github.com/spf13/cobra" "github.com/spf13/viper" ) diff --git a/internal/cmd/report/report_test.go b/internal/cmd/report/report_test.go index 09cd54a3..19de982c 100644 --- a/internal/cmd/report/report_test.go +++ b/internal/cmd/report/report_test.go @@ -3,8 +3,8 @@ package report import ( "testing" - "github.com/debricked/cli/pkg/report/license" - "github.com/debricked/cli/pkg/report/vulnerability" + "github.com/debricked/cli/internal/report/license" + "github.com/debricked/cli/internal/report/vulnerability" "github.com/stretchr/testify/assert" ) diff --git a/pkg/cmd/resolve/resolve.go b/internal/cmd/resolve/resolve.go similarity index 95% rename from pkg/cmd/resolve/resolve.go rename to internal/cmd/resolve/resolve.go index de9c4383..5854c079 100644 --- a/pkg/cmd/resolve/resolve.go +++ b/internal/cmd/resolve/resolve.go @@ -4,8 +4,8 @@ import ( "fmt" "path/filepath" - "github.com/debricked/cli/pkg/file" - "github.com/debricked/cli/pkg/resolution" + "github.com/debricked/cli/internal/file" + "github.com/debricked/cli/internal/resolution" "github.com/spf13/cobra" "github.com/spf13/viper" ) diff --git a/pkg/cmd/resolve/resolve_test.go b/internal/cmd/resolve/resolve_test.go similarity index 90% rename from pkg/cmd/resolve/resolve_test.go rename to internal/cmd/resolve/resolve_test.go index 5e8db813..e46cee5e 100644 --- a/pkg/cmd/resolve/resolve_test.go +++ b/internal/cmd/resolve/resolve_test.go @@ -4,10 +4,10 @@ import ( "errors" "testing" - "github.com/debricked/cli/pkg/file" - "github.com/debricked/cli/pkg/file/testdata" - "github.com/debricked/cli/pkg/resolution" - resolveTestdata "github.com/debricked/cli/pkg/resolution/testdata" + "github.com/debricked/cli/internal/file" + "github.com/debricked/cli/internal/file/testdata" + "github.com/debricked/cli/internal/resolution" + resolveTestdata "github.com/debricked/cli/internal/resolution/testdata" "github.com/spf13/viper" "github.com/stretchr/testify/assert" ) diff --git a/internal/cmd/root/root.go b/internal/cmd/root/root.go index bda4ae7e..259e90da 100644 --- a/internal/cmd/root/root.go +++ b/internal/cmd/root/root.go @@ -1,11 +1,11 @@ package root import ( - "github.com/debricked/cli/pkg/cmd/files" - "github.com/debricked/cli/pkg/cmd/report" - "github.com/debricked/cli/pkg/cmd/resolve" - "github.com/debricked/cli/pkg/cmd/scan" - "github.com/debricked/cli/pkg/wire" + "github.com/debricked/cli/internal/cmd/files" + "github.com/debricked/cli/internal/cmd/report" + "github.com/debricked/cli/internal/cmd/resolve" + "github.com/debricked/cli/internal/cmd/scan" + "github.com/debricked/cli/internal/wire" "github.com/spf13/cobra" "github.com/spf13/viper" ) diff --git a/internal/cmd/root/root_test.go b/internal/cmd/root/root_test.go index 3607bbe6..a69d742b 100644 --- a/internal/cmd/root/root_test.go +++ b/internal/cmd/root/root_test.go @@ -3,7 +3,7 @@ package root import ( "testing" - "github.com/debricked/cli/pkg/wire" + "github.com/debricked/cli/internal/wire" "github.com/spf13/viper" "github.com/stretchr/testify/assert" ) diff --git a/internal/cmd/scan/scan.go b/internal/cmd/scan/scan.go index 1a6e56ea..4f6afef8 100644 --- a/internal/cmd/scan/scan.go +++ b/internal/cmd/scan/scan.go @@ -5,8 +5,8 @@ import ( "fmt" "path/filepath" - "github.com/debricked/cli/pkg/file" - "github.com/debricked/cli/pkg/scan" + "github.com/debricked/cli/internal/file" + "github.com/debricked/cli/internal/scan" "github.com/fatih/color" "github.com/spf13/cobra" "github.com/spf13/viper" diff --git a/internal/cmd/scan/scan_test.go b/internal/cmd/scan/scan_test.go index 9ce7cea7..1b1e71a3 100644 --- a/internal/cmd/scan/scan_test.go +++ b/internal/cmd/scan/scan_test.go @@ -3,7 +3,7 @@ package scan import ( "testing" - "github.com/debricked/cli/pkg/scan" + "github.com/debricked/cli/internal/scan" "github.com/spf13/cobra" "github.com/spf13/viper" "github.com/stretchr/testify/assert" diff --git a/pkg/scan/testdata/npm/package.json b/internal/cmd/scan/testdata/npm/package.json similarity index 100% rename from pkg/scan/testdata/npm/package.json rename to internal/cmd/scan/testdata/npm/package.json diff --git a/pkg/resolution/file/file_batch.go b/internal/resolution/file/file_batch.go similarity index 89% rename from pkg/resolution/file/file_batch.go rename to internal/resolution/file/file_batch.go index 3ccc47d6..de33d37c 100644 --- a/pkg/resolution/file/file_batch.go +++ b/internal/resolution/file/file_batch.go @@ -1,6 +1,6 @@ package file -import "github.com/debricked/cli/pkg/resolution/pm" +import "github.com/debricked/cli/internal/resolution/pm" type IBatch interface { Files() []string diff --git a/pkg/resolution/file/file_batch_factory.go b/internal/resolution/file/file_batch_factory.go similarity index 94% rename from pkg/resolution/file/file_batch_factory.go rename to internal/resolution/file/file_batch_factory.go index 7ac062de..22818166 100644 --- a/pkg/resolution/file/file_batch_factory.go +++ b/internal/resolution/file/file_batch_factory.go @@ -4,7 +4,7 @@ import ( "path" "regexp" - "github.com/debricked/cli/pkg/resolution/pm" + "github.com/debricked/cli/internal/resolution/pm" ) type IBatchFactory interface { diff --git a/pkg/resolution/file/file_batch_factory_test.go b/internal/resolution/file/file_batch_factory_test.go similarity index 95% rename from pkg/resolution/file/file_batch_factory_test.go rename to internal/resolution/file/file_batch_factory_test.go index 29a06620..ffec511b 100644 --- a/pkg/resolution/file/file_batch_factory_test.go +++ b/internal/resolution/file/file_batch_factory_test.go @@ -3,8 +3,8 @@ package file import ( "testing" - "github.com/debricked/cli/pkg/resolution/pm" - "github.com/debricked/cli/pkg/resolution/pm/testdata" + "github.com/debricked/cli/internal/resolution/pm" + "github.com/debricked/cli/internal/resolution/pm/testdata" "github.com/stretchr/testify/assert" ) diff --git a/pkg/resolution/file/file_batch_test.go b/internal/resolution/file/file_batch_test.go similarity index 93% rename from pkg/resolution/file/file_batch_test.go rename to internal/resolution/file/file_batch_test.go index 19d60096..4cdc0e0e 100644 --- a/pkg/resolution/file/file_batch_test.go +++ b/internal/resolution/file/file_batch_test.go @@ -3,7 +3,7 @@ package file import ( "testing" - "github.com/debricked/cli/pkg/resolution/pm/testdata" + "github.com/debricked/cli/internal/resolution/pm/testdata" "github.com/stretchr/testify/assert" ) diff --git a/pkg/resolution/file/testdata/file_batch_factory_mock.go b/internal/resolution/file/testdata/file_batch_factory_mock.go similarity index 71% rename from pkg/resolution/file/testdata/file_batch_factory_mock.go rename to internal/resolution/file/testdata/file_batch_factory_mock.go index 9c81add4..c0ed5511 100644 --- a/pkg/resolution/file/testdata/file_batch_factory_mock.go +++ b/internal/resolution/file/testdata/file_batch_factory_mock.go @@ -1,8 +1,8 @@ package testdata import ( - "github.com/debricked/cli/pkg/resolution/file" - "github.com/debricked/cli/pkg/resolution/pm" + "github.com/debricked/cli/internal/resolution/file" + "github.com/debricked/cli/internal/resolution/pm" ) type BatchFactoryMock struct { diff --git a/pkg/resolution/file/testdata/file_batch_mock.go b/internal/resolution/file/testdata/file_batch_mock.go similarity index 100% rename from pkg/resolution/file/testdata/file_batch_mock.go rename to internal/resolution/file/testdata/file_batch_mock.go diff --git a/pkg/resolution/job/base_job.go b/internal/resolution/job/base_job.go similarity index 100% rename from pkg/resolution/job/base_job.go rename to internal/resolution/job/base_job.go diff --git a/pkg/resolution/job/base_job_test.go b/internal/resolution/job/base_job_test.go similarity index 100% rename from pkg/resolution/job/base_job_test.go rename to internal/resolution/job/base_job_test.go diff --git a/pkg/resolution/job/error.go b/internal/resolution/job/error.go similarity index 100% rename from pkg/resolution/job/error.go rename to internal/resolution/job/error.go diff --git a/pkg/resolution/job/errors.go b/internal/resolution/job/errors.go similarity index 100% rename from pkg/resolution/job/errors.go rename to internal/resolution/job/errors.go diff --git a/pkg/resolution/job/errors_test.go b/internal/resolution/job/errors_test.go similarity index 100% rename from pkg/resolution/job/errors_test.go rename to internal/resolution/job/errors_test.go diff --git a/pkg/resolution/job/job.go b/internal/resolution/job/job.go similarity index 100% rename from pkg/resolution/job/job.go rename to internal/resolution/job/job.go diff --git a/pkg/resolution/job/testdata/job_mock.go b/internal/resolution/job/testdata/job_mock.go similarity index 91% rename from pkg/resolution/job/testdata/job_mock.go rename to internal/resolution/job/testdata/job_mock.go index ff3fd291..17f648c4 100644 --- a/pkg/resolution/job/testdata/job_mock.go +++ b/internal/resolution/job/testdata/job_mock.go @@ -3,7 +3,7 @@ package testdata import ( "fmt" - "github.com/debricked/cli/pkg/resolution/job" + "github.com/debricked/cli/internal/resolution/job" ) type JobMock struct { diff --git a/pkg/resolution/job/testdata/job_test_util.go b/internal/resolution/job/testdata/job_test_util.go similarity index 90% rename from pkg/resolution/job/testdata/job_test_util.go rename to internal/resolution/job/testdata/job_test_util.go index 4d1a9526..4e37e001 100644 --- a/pkg/resolution/job/testdata/job_test_util.go +++ b/internal/resolution/job/testdata/job_test_util.go @@ -5,7 +5,7 @@ import ( "runtime" "testing" - "github.com/debricked/cli/pkg/resolution/job" + "github.com/debricked/cli/internal/resolution/job" "github.com/stretchr/testify/assert" ) diff --git a/pkg/resolution/pm/gomod/cmd_factory.go b/internal/resolution/pm/gomod/cmd_factory.go similarity index 100% rename from pkg/resolution/pm/gomod/cmd_factory.go rename to internal/resolution/pm/gomod/cmd_factory.go diff --git a/pkg/resolution/pm/gomod/cmd_factory_test.go b/internal/resolution/pm/gomod/cmd_factory_test.go similarity index 100% rename from pkg/resolution/pm/gomod/cmd_factory_test.go rename to internal/resolution/pm/gomod/cmd_factory_test.go diff --git a/pkg/resolution/pm/gomod/job.go b/internal/resolution/pm/gomod/job.go similarity index 91% rename from pkg/resolution/pm/gomod/job.go rename to internal/resolution/pm/gomod/job.go index 996529e2..13c0fa3a 100644 --- a/pkg/resolution/pm/gomod/job.go +++ b/internal/resolution/pm/gomod/job.go @@ -3,9 +3,9 @@ package gomod import ( "path/filepath" - "github.com/debricked/cli/pkg/resolution/job" - "github.com/debricked/cli/pkg/resolution/pm/util" - "github.com/debricked/cli/pkg/resolution/pm/writer" + "github.com/debricked/cli/internal/resolution/job" + "github.com/debricked/cli/internal/resolution/pm/util" + "github.com/debricked/cli/internal/resolution/pm/writer" ) const ( diff --git a/pkg/resolution/pm/gomod/job_test.go b/internal/resolution/pm/gomod/job_test.go similarity index 91% rename from pkg/resolution/pm/gomod/job_test.go rename to internal/resolution/pm/gomod/job_test.go index c0363309..5fb2c4b4 100644 --- a/pkg/resolution/pm/gomod/job_test.go +++ b/internal/resolution/pm/gomod/job_test.go @@ -4,10 +4,10 @@ import ( "errors" "testing" - jobTestdata "github.com/debricked/cli/pkg/resolution/job/testdata" - "github.com/debricked/cli/pkg/resolution/pm/gomod/testdata" - "github.com/debricked/cli/pkg/resolution/pm/writer" - writerTestdata "github.com/debricked/cli/pkg/resolution/pm/writer/testdata" + jobTestdata "github.com/debricked/cli/internal/resolution/job/testdata" + "github.com/debricked/cli/internal/resolution/pm/gomod/testdata" + "github.com/debricked/cli/internal/resolution/pm/writer" + writerTestdata "github.com/debricked/cli/internal/resolution/pm/writer/testdata" "github.com/stretchr/testify/assert" ) diff --git a/pkg/resolution/pm/gomod/pm.go b/internal/resolution/pm/gomod/pm.go similarity index 100% rename from pkg/resolution/pm/gomod/pm.go rename to internal/resolution/pm/gomod/pm.go diff --git a/pkg/resolution/pm/gomod/pm_test.go b/internal/resolution/pm/gomod/pm_test.go similarity index 100% rename from pkg/resolution/pm/gomod/pm_test.go rename to internal/resolution/pm/gomod/pm_test.go diff --git a/pkg/resolution/pm/gomod/strategy.go b/internal/resolution/pm/gomod/strategy.go similarity index 75% rename from pkg/resolution/pm/gomod/strategy.go rename to internal/resolution/pm/gomod/strategy.go index 962dd91d..c65fcbb9 100644 --- a/pkg/resolution/pm/gomod/strategy.go +++ b/internal/resolution/pm/gomod/strategy.go @@ -1,8 +1,8 @@ package gomod import ( - "github.com/debricked/cli/pkg/resolution/job" - "github.com/debricked/cli/pkg/resolution/pm/writer" + "github.com/debricked/cli/internal/resolution/job" + "github.com/debricked/cli/internal/resolution/pm/writer" ) type Strategy struct { diff --git a/pkg/resolution/pm/gomod/strategy_test.go b/internal/resolution/pm/gomod/strategy_test.go similarity index 100% rename from pkg/resolution/pm/gomod/strategy_test.go rename to internal/resolution/pm/gomod/strategy_test.go diff --git a/pkg/resolution/pm/gomod/testdata/cmd_factory_mock.go b/internal/resolution/pm/gomod/testdata/cmd_factory_mock.go similarity index 100% rename from pkg/resolution/pm/gomod/testdata/cmd_factory_mock.go rename to internal/resolution/pm/gomod/testdata/cmd_factory_mock.go diff --git a/pkg/resolution/pm/gradle/cmd_factory.go b/internal/resolution/pm/gradle/cmd_factory.go similarity index 100% rename from pkg/resolution/pm/gradle/cmd_factory.go rename to internal/resolution/pm/gradle/cmd_factory.go diff --git a/pkg/resolution/pm/gradle/cmd_factory_test.go b/internal/resolution/pm/gradle/cmd_factory_test.go similarity index 100% rename from pkg/resolution/pm/gradle/cmd_factory_test.go rename to internal/resolution/pm/gradle/cmd_factory_test.go diff --git a/pkg/resolution/pm/gradle/gradle-init/gradle-init-script.groovy b/internal/resolution/pm/gradle/gradle-init/gradle-init-script.groovy similarity index 100% rename from pkg/resolution/pm/gradle/gradle-init/gradle-init-script.groovy rename to internal/resolution/pm/gradle/gradle-init/gradle-init-script.groovy diff --git a/pkg/resolution/pm/gradle/init_script_handler.go b/internal/resolution/pm/gradle/init_script_handler.go similarity index 93% rename from pkg/resolution/pm/gradle/init_script_handler.go rename to internal/resolution/pm/gradle/init_script_handler.go index 1ed91f05..4ef15568 100644 --- a/pkg/resolution/pm/gradle/init_script_handler.go +++ b/internal/resolution/pm/gradle/init_script_handler.go @@ -1,7 +1,7 @@ package gradle import ( - "github.com/debricked/cli/pkg/resolution/pm/writer" + "github.com/debricked/cli/internal/resolution/pm/writer" ) type IInitScriptHandler interface { diff --git a/pkg/resolution/pm/gradle/init_script_handler_test.go b/internal/resolution/pm/gradle/init_script_handler_test.go similarity index 92% rename from pkg/resolution/pm/gradle/init_script_handler_test.go rename to internal/resolution/pm/gradle/init_script_handler_test.go index 06cda882..ed69ab58 100644 --- a/pkg/resolution/pm/gradle/init_script_handler_test.go +++ b/internal/resolution/pm/gradle/init_script_handler_test.go @@ -5,7 +5,7 @@ import ( "errors" "testing" - writerTestdata "github.com/debricked/cli/pkg/resolution/pm/writer/testdata" + writerTestdata "github.com/debricked/cli/internal/resolution/pm/writer/testdata" "github.com/stretchr/testify/assert" ) diff --git a/pkg/resolution/pm/gradle/job.go b/internal/resolution/pm/gradle/job.go similarity index 93% rename from pkg/resolution/pm/gradle/job.go rename to internal/resolution/pm/gradle/job.go index 3373a45c..e1637244 100644 --- a/pkg/resolution/pm/gradle/job.go +++ b/internal/resolution/pm/gradle/job.go @@ -5,8 +5,8 @@ import ( "path/filepath" "strings" - "github.com/debricked/cli/pkg/resolution/job" - "github.com/debricked/cli/pkg/resolution/pm/writer" + "github.com/debricked/cli/internal/resolution/job" + "github.com/debricked/cli/internal/resolution/pm/writer" ) type Job struct { diff --git a/pkg/resolution/pm/gradle/job_test.go b/internal/resolution/pm/gradle/job_test.go similarity index 93% rename from pkg/resolution/pm/gradle/job_test.go rename to internal/resolution/pm/gradle/job_test.go index 54b976c3..c04186e7 100644 --- a/pkg/resolution/pm/gradle/job_test.go +++ b/internal/resolution/pm/gradle/job_test.go @@ -4,10 +4,10 @@ import ( "errors" "testing" - jobTestdata "github.com/debricked/cli/pkg/resolution/job/testdata" - "github.com/debricked/cli/pkg/resolution/pm/gradle/testdata" - "github.com/debricked/cli/pkg/resolution/pm/writer" - writerTestdata "github.com/debricked/cli/pkg/resolution/pm/writer/testdata" + jobTestdata "github.com/debricked/cli/internal/resolution/job/testdata" + "github.com/debricked/cli/internal/resolution/pm/gradle/testdata" + "github.com/debricked/cli/internal/resolution/pm/writer" + writerTestdata "github.com/debricked/cli/internal/resolution/pm/writer/testdata" "github.com/stretchr/testify/assert" ) diff --git a/pkg/resolution/pm/gradle/meta_file_finder.go b/internal/resolution/pm/gradle/meta_file_finder.go similarity index 100% rename from pkg/resolution/pm/gradle/meta_file_finder.go rename to internal/resolution/pm/gradle/meta_file_finder.go diff --git a/pkg/resolution/pm/gradle/meta_file_finder_test.go b/internal/resolution/pm/gradle/meta_file_finder_test.go similarity index 100% rename from pkg/resolution/pm/gradle/meta_file_finder_test.go rename to internal/resolution/pm/gradle/meta_file_finder_test.go diff --git a/pkg/resolution/pm/gradle/pm.go b/internal/resolution/pm/gradle/pm.go similarity index 100% rename from pkg/resolution/pm/gradle/pm.go rename to internal/resolution/pm/gradle/pm.go diff --git a/pkg/resolution/pm/gradle/pm_test.go b/internal/resolution/pm/gradle/pm_test.go similarity index 100% rename from pkg/resolution/pm/gradle/pm_test.go rename to internal/resolution/pm/gradle/pm_test.go diff --git a/pkg/resolution/pm/gradle/project.go b/internal/resolution/pm/gradle/project.go similarity index 100% rename from pkg/resolution/pm/gradle/project.go rename to internal/resolution/pm/gradle/project.go diff --git a/pkg/resolution/pm/gradle/setup.go b/internal/resolution/pm/gradle/setup.go similarity index 98% rename from pkg/resolution/pm/gradle/setup.go rename to internal/resolution/pm/gradle/setup.go index 3b3bcf95..f7134fd9 100644 --- a/pkg/resolution/pm/gradle/setup.go +++ b/internal/resolution/pm/gradle/setup.go @@ -10,7 +10,7 @@ import ( "sort" "strings" - "github.com/debricked/cli/pkg/resolution/pm/writer" + "github.com/debricked/cli/internal/resolution/pm/writer" ) const ( diff --git a/pkg/resolution/pm/gradle/setup_err.go b/internal/resolution/pm/gradle/setup_err.go similarity index 100% rename from pkg/resolution/pm/gradle/setup_err.go rename to internal/resolution/pm/gradle/setup_err.go diff --git a/pkg/resolution/pm/gradle/setup_test.go b/internal/resolution/pm/gradle/setup_test.go similarity index 97% rename from pkg/resolution/pm/gradle/setup_test.go rename to internal/resolution/pm/gradle/setup_test.go index e57ee798..7781373b 100644 --- a/pkg/resolution/pm/gradle/setup_test.go +++ b/internal/resolution/pm/gradle/setup_test.go @@ -8,9 +8,9 @@ import ( "runtime" "testing" - writerTestdata "github.com/debricked/cli/pkg/resolution/pm/writer/testdata" + writerTestdata "github.com/debricked/cli/internal/resolution/pm/writer/testdata" - "github.com/debricked/cli/pkg/resolution/pm/writer" + "github.com/debricked/cli/internal/resolution/pm/writer" "github.com/stretchr/testify/assert" ) diff --git a/pkg/resolution/pm/gradle/strategy.go b/internal/resolution/pm/gradle/strategy.go similarity index 93% rename from pkg/resolution/pm/gradle/strategy.go rename to internal/resolution/pm/gradle/strategy.go index 311b744b..1e63a160 100644 --- a/pkg/resolution/pm/gradle/strategy.go +++ b/internal/resolution/pm/gradle/strategy.go @@ -8,8 +8,8 @@ import ( "github.com/fatih/color" - "github.com/debricked/cli/pkg/resolution/job" - "github.com/debricked/cli/pkg/resolution/pm/writer" + "github.com/debricked/cli/internal/resolution/job" + "github.com/debricked/cli/internal/resolution/pm/writer" ) type Strategy struct { diff --git a/pkg/resolution/pm/gradle/strategy_test.go b/internal/resolution/pm/gradle/strategy_test.go similarity index 100% rename from pkg/resolution/pm/gradle/strategy_test.go rename to internal/resolution/pm/gradle/strategy_test.go diff --git a/pkg/resolution/pm/gradle/testdata/cmd_factory_mock.go b/internal/resolution/pm/gradle/testdata/cmd_factory_mock.go similarity index 100% rename from pkg/resolution/pm/gradle/testdata/cmd_factory_mock.go rename to internal/resolution/pm/gradle/testdata/cmd_factory_mock.go diff --git a/pkg/resolution/pm/gradle/testdata/project/build.gradle b/internal/resolution/pm/gradle/testdata/project/build.gradle similarity index 100% rename from pkg/resolution/pm/gradle/testdata/project/build.gradle rename to internal/resolution/pm/gradle/testdata/project/build.gradle diff --git a/pkg/resolution/pm/gradle/testdata/project/gradlew b/internal/resolution/pm/gradle/testdata/project/gradlew similarity index 100% rename from pkg/resolution/pm/gradle/testdata/project/gradlew rename to internal/resolution/pm/gradle/testdata/project/gradlew diff --git a/pkg/resolution/pm/gradle/testdata/project/gradlew.bat b/internal/resolution/pm/gradle/testdata/project/gradlew.bat similarity index 100% rename from pkg/resolution/pm/gradle/testdata/project/gradlew.bat rename to internal/resolution/pm/gradle/testdata/project/gradlew.bat diff --git a/pkg/resolution/pm/gradle/testdata/project/settings.gradle b/internal/resolution/pm/gradle/testdata/project/settings.gradle similarity index 100% rename from pkg/resolution/pm/gradle/testdata/project/settings.gradle rename to internal/resolution/pm/gradle/testdata/project/settings.gradle diff --git a/pkg/resolution/pm/gradle/testdata/project/subproject/build.gradle b/internal/resolution/pm/gradle/testdata/project/subproject/build.gradle similarity index 100% rename from pkg/resolution/pm/gradle/testdata/project/subproject/build.gradle rename to internal/resolution/pm/gradle/testdata/project/subproject/build.gradle diff --git a/pkg/resolution/pm/maven/cmd_factory.go b/internal/resolution/pm/maven/cmd_factory.go similarity index 100% rename from pkg/resolution/pm/maven/cmd_factory.go rename to internal/resolution/pm/maven/cmd_factory.go diff --git a/pkg/resolution/pm/maven/cmd_factory_test.go b/internal/resolution/pm/maven/cmd_factory_test.go similarity index 100% rename from pkg/resolution/pm/maven/cmd_factory_test.go rename to internal/resolution/pm/maven/cmd_factory_test.go diff --git a/pkg/resolution/pm/maven/job.go b/internal/resolution/pm/maven/job.go similarity index 92% rename from pkg/resolution/pm/maven/job.go rename to internal/resolution/pm/maven/job.go index 6af48b6e..7de360d4 100644 --- a/pkg/resolution/pm/maven/job.go +++ b/internal/resolution/pm/maven/job.go @@ -4,7 +4,7 @@ import ( "errors" "path/filepath" - "github.com/debricked/cli/pkg/resolution/job" + "github.com/debricked/cli/internal/resolution/job" ) type Job struct { diff --git a/pkg/resolution/pm/maven/job_test.go b/internal/resolution/pm/maven/job_test.go similarity index 90% rename from pkg/resolution/pm/maven/job_test.go rename to internal/resolution/pm/maven/job_test.go index 0787694a..78da6a71 100644 --- a/pkg/resolution/pm/maven/job_test.go +++ b/internal/resolution/pm/maven/job_test.go @@ -4,8 +4,8 @@ import ( "errors" "testing" - jobTestdata "github.com/debricked/cli/pkg/resolution/job/testdata" - "github.com/debricked/cli/pkg/resolution/pm/maven/testdata" + jobTestdata "github.com/debricked/cli/internal/resolution/job/testdata" + "github.com/debricked/cli/internal/resolution/pm/maven/testdata" "github.com/stretchr/testify/assert" ) diff --git a/pkg/resolution/pm/maven/pm.go b/internal/resolution/pm/maven/pm.go similarity index 100% rename from pkg/resolution/pm/maven/pm.go rename to internal/resolution/pm/maven/pm.go diff --git a/pkg/resolution/pm/maven/pm_test.go b/internal/resolution/pm/maven/pm_test.go similarity index 100% rename from pkg/resolution/pm/maven/pm_test.go rename to internal/resolution/pm/maven/pm_test.go diff --git a/pkg/resolution/pm/maven/pom_service.go b/internal/resolution/pm/maven/pom_service.go similarity index 100% rename from pkg/resolution/pm/maven/pom_service.go rename to internal/resolution/pm/maven/pom_service.go diff --git a/pkg/resolution/pm/maven/pom_service_test.go b/internal/resolution/pm/maven/pom_service_test.go similarity index 100% rename from pkg/resolution/pm/maven/pom_service_test.go rename to internal/resolution/pm/maven/pom_service_test.go diff --git a/pkg/resolution/pm/maven/strategy.go b/internal/resolution/pm/maven/strategy.go similarity index 89% rename from pkg/resolution/pm/maven/strategy.go rename to internal/resolution/pm/maven/strategy.go index f3e3850f..a69e4fd1 100644 --- a/pkg/resolution/pm/maven/strategy.go +++ b/internal/resolution/pm/maven/strategy.go @@ -1,7 +1,7 @@ package maven import ( - "github.com/debricked/cli/pkg/resolution/job" + "github.com/debricked/cli/internal/resolution/job" ) type Strategy struct { diff --git a/pkg/resolution/pm/maven/strategy_test.go b/internal/resolution/pm/maven/strategy_test.go similarity index 100% rename from pkg/resolution/pm/maven/strategy_test.go rename to internal/resolution/pm/maven/strategy_test.go diff --git a/pkg/resolution/pm/maven/testdata/cmd_factory_mock.go b/internal/resolution/pm/maven/testdata/cmd_factory_mock.go similarity index 100% rename from pkg/resolution/pm/maven/testdata/cmd_factory_mock.go rename to internal/resolution/pm/maven/testdata/cmd_factory_mock.go diff --git a/pkg/resolution/pm/maven/testdata/guava/pom.xml b/internal/resolution/pm/maven/testdata/guava/pom.xml similarity index 100% rename from pkg/resolution/pm/maven/testdata/guava/pom.xml rename to internal/resolution/pm/maven/testdata/guava/pom.xml diff --git a/pkg/resolution/pm/maven/testdata/notAPom.xml b/internal/resolution/pm/maven/testdata/notAPom.xml similarity index 100% rename from pkg/resolution/pm/maven/testdata/notAPom.xml rename to internal/resolution/pm/maven/testdata/notAPom.xml diff --git a/pkg/resolution/pm/maven/testdata/pom.xml b/internal/resolution/pm/maven/testdata/pom.xml similarity index 100% rename from pkg/resolution/pm/maven/testdata/pom.xml rename to internal/resolution/pm/maven/testdata/pom.xml diff --git a/pkg/resolution/pm/pip/cmd_factory.go b/internal/resolution/pm/pip/cmd_factory.go similarity index 100% rename from pkg/resolution/pm/pip/cmd_factory.go rename to internal/resolution/pm/pip/cmd_factory.go diff --git a/pkg/resolution/pm/pip/cmd_factory_test.go b/internal/resolution/pm/pip/cmd_factory_test.go similarity index 100% rename from pkg/resolution/pm/pip/cmd_factory_test.go rename to internal/resolution/pm/pip/cmd_factory_test.go diff --git a/pkg/resolution/pm/pip/job.go b/internal/resolution/pm/pip/job.go similarity index 96% rename from pkg/resolution/pm/pip/job.go rename to internal/resolution/pm/pip/job.go index 4d03fdc8..c99ba305 100644 --- a/pkg/resolution/pm/pip/job.go +++ b/internal/resolution/pm/pip/job.go @@ -6,9 +6,9 @@ import ( "path/filepath" "strings" - "github.com/debricked/cli/pkg/resolution/job" - "github.com/debricked/cli/pkg/resolution/pm/util" - "github.com/debricked/cli/pkg/resolution/pm/writer" + "github.com/debricked/cli/internal/resolution/job" + "github.com/debricked/cli/internal/resolution/pm/util" + "github.com/debricked/cli/internal/resolution/pm/writer" ) const ( diff --git a/pkg/resolution/pm/pip/job_test.go b/internal/resolution/pm/pip/job_test.go similarity index 96% rename from pkg/resolution/pm/pip/job_test.go rename to internal/resolution/pm/pip/job_test.go index 19f010aa..f70f6a31 100644 --- a/pkg/resolution/pm/pip/job_test.go +++ b/internal/resolution/pm/pip/job_test.go @@ -7,10 +7,10 @@ import ( "strings" "testing" - jobTestdata "github.com/debricked/cli/pkg/resolution/job/testdata" - "github.com/debricked/cli/pkg/resolution/pm/pip/testdata" - "github.com/debricked/cli/pkg/resolution/pm/writer" - writerTestdata "github.com/debricked/cli/pkg/resolution/pm/writer/testdata" + jobTestdata "github.com/debricked/cli/internal/resolution/job/testdata" + "github.com/debricked/cli/internal/resolution/pm/pip/testdata" + "github.com/debricked/cli/internal/resolution/pm/writer" + writerTestdata "github.com/debricked/cli/internal/resolution/pm/writer/testdata" "github.com/stretchr/testify/assert" ) diff --git a/pkg/resolution/pm/pip/pm.go b/internal/resolution/pm/pip/pm.go similarity index 100% rename from pkg/resolution/pm/pip/pm.go rename to internal/resolution/pm/pip/pm.go diff --git a/pkg/resolution/pm/pip/pm_test.go b/internal/resolution/pm/pip/pm_test.go similarity index 100% rename from pkg/resolution/pm/pip/pm_test.go rename to internal/resolution/pm/pip/pm_test.go diff --git a/pkg/resolution/pm/pip/strategy.go b/internal/resolution/pm/pip/strategy.go similarity index 78% rename from pkg/resolution/pm/pip/strategy.go rename to internal/resolution/pm/pip/strategy.go index bed6ec83..4ced23da 100644 --- a/pkg/resolution/pm/pip/strategy.go +++ b/internal/resolution/pm/pip/strategy.go @@ -1,8 +1,8 @@ package pip import ( - "github.com/debricked/cli/pkg/resolution/job" - "github.com/debricked/cli/pkg/resolution/pm/writer" + "github.com/debricked/cli/internal/resolution/job" + "github.com/debricked/cli/internal/resolution/pm/writer" ) type Strategy struct { diff --git a/pkg/resolution/pm/pip/strategy_test.go b/internal/resolution/pm/pip/strategy_test.go similarity index 100% rename from pkg/resolution/pm/pip/strategy_test.go rename to internal/resolution/pm/pip/strategy_test.go diff --git a/pkg/resolution/pm/pip/testdata/cmd_factory_mock.go b/internal/resolution/pm/pip/testdata/cmd_factory_mock.go similarity index 100% rename from pkg/resolution/pm/pip/testdata/cmd_factory_mock.go rename to internal/resolution/pm/pip/testdata/cmd_factory_mock.go diff --git a/pkg/resolution/pm/pip/testdata/list.txt b/internal/resolution/pm/pip/testdata/list.txt similarity index 100% rename from pkg/resolution/pm/pip/testdata/list.txt rename to internal/resolution/pm/pip/testdata/list.txt diff --git a/pkg/resolution/pm/pip/testdata/requirements.txt b/internal/resolution/pm/pip/testdata/requirements.txt similarity index 100% rename from pkg/resolution/pm/pip/testdata/requirements.txt rename to internal/resolution/pm/pip/testdata/requirements.txt diff --git a/pkg/resolution/pm/pip/testdata/show.txt b/internal/resolution/pm/pip/testdata/show.txt similarity index 100% rename from pkg/resolution/pm/pip/testdata/show.txt rename to internal/resolution/pm/pip/testdata/show.txt diff --git a/internal/resolution/pm/pm.go b/internal/resolution/pm/pm.go new file mode 100644 index 00000000..844d3c51 --- /dev/null +++ b/internal/resolution/pm/pm.go @@ -0,0 +1,22 @@ +package pm + +import ( + "github.com/debricked/cli/internal/resolution/pm/gomod" + "github.com/debricked/cli/internal/resolution/pm/gradle" + "github.com/debricked/cli/internal/resolution/pm/maven" + "github.com/debricked/cli/internal/resolution/pm/pip" +) + +type IPm interface { + Name() string + Manifests() []string +} + +func Pms() []IPm { + return []IPm{ + maven.NewPm(), + gradle.NewPm(), + gomod.NewPm(), + pip.NewPm(), + } +} diff --git a/pkg/resolution/pm/pm_test.go b/internal/resolution/pm/pm_test.go similarity index 100% rename from pkg/resolution/pm/pm_test.go rename to internal/resolution/pm/pm_test.go diff --git a/pkg/resolution/pm/testdata/pm_mock.go b/internal/resolution/pm/testdata/pm_mock.go similarity index 100% rename from pkg/resolution/pm/testdata/pm_mock.go rename to internal/resolution/pm/testdata/pm_mock.go diff --git a/pkg/resolution/pm/util/util.go b/internal/resolution/pm/util/util.go similarity index 82% rename from pkg/resolution/pm/util/util.go rename to internal/resolution/pm/util/util.go index 25220026..3d620762 100644 --- a/pkg/resolution/pm/util/util.go +++ b/internal/resolution/pm/util/util.go @@ -6,8 +6,8 @@ import ( "path/filepath" "strings" - "github.com/debricked/cli/pkg/resolution/job" - "github.com/debricked/cli/pkg/resolution/pm/writer" + "github.com/debricked/cli/internal/resolution/job" + "github.com/debricked/cli/internal/resolution/pm/writer" ) func MakePathFromManifestFile(siblingFile string, fileName string) string { diff --git a/pkg/resolution/pm/util/util_test.go b/internal/resolution/pm/util/util_test.go similarity index 87% rename from pkg/resolution/pm/util/util_test.go rename to internal/resolution/pm/util/util_test.go index 763db86a..cfe951ae 100644 --- a/pkg/resolution/pm/util/util_test.go +++ b/internal/resolution/pm/util/util_test.go @@ -7,9 +7,9 @@ import ( "path/filepath" "testing" - "github.com/debricked/cli/pkg/resolution/job" - "github.com/debricked/cli/pkg/resolution/job/testdata" - writerTestdata "github.com/debricked/cli/pkg/resolution/pm/writer/testdata" + "github.com/debricked/cli/internal/resolution/job" + "github.com/debricked/cli/internal/resolution/job/testdata" + writerTestdata "github.com/debricked/cli/internal/resolution/pm/writer/testdata" "github.com/stretchr/testify/assert" ) diff --git a/pkg/resolution/pm/writer/file_writer.go b/internal/resolution/pm/writer/file_writer.go similarity index 100% rename from pkg/resolution/pm/writer/file_writer.go rename to internal/resolution/pm/writer/file_writer.go diff --git a/pkg/resolution/pm/writer/file_writer_test.go b/internal/resolution/pm/writer/file_writer_test.go similarity index 100% rename from pkg/resolution/pm/writer/file_writer_test.go rename to internal/resolution/pm/writer/file_writer_test.go diff --git a/pkg/resolution/pm/writer/testdata/file_writer_mock.go b/internal/resolution/pm/writer/testdata/file_writer_mock.go similarity index 100% rename from pkg/resolution/pm/writer/testdata/file_writer_mock.go rename to internal/resolution/pm/writer/testdata/file_writer_mock.go diff --git a/pkg/resolution/resolution.go b/internal/resolution/resolution.go similarity index 87% rename from pkg/resolution/resolution.go rename to internal/resolution/resolution.go index d1818b9c..8d1781f9 100644 --- a/pkg/resolution/resolution.go +++ b/internal/resolution/resolution.go @@ -1,6 +1,6 @@ package resolution -import "github.com/debricked/cli/pkg/resolution/job" +import "github.com/debricked/cli/internal/resolution/job" type IResolution interface { Jobs() []job.IJob diff --git a/pkg/resolution/resolution_test.go b/internal/resolution/resolution_test.go similarity index 90% rename from pkg/resolution/resolution_test.go rename to internal/resolution/resolution_test.go index 16d58a2e..1062ca7a 100644 --- a/pkg/resolution/resolution_test.go +++ b/internal/resolution/resolution_test.go @@ -4,8 +4,8 @@ import ( "errors" "testing" - "github.com/debricked/cli/pkg/resolution/job" - "github.com/debricked/cli/pkg/resolution/job/testdata" + "github.com/debricked/cli/internal/resolution/job" + "github.com/debricked/cli/internal/resolution/job/testdata" "github.com/stretchr/testify/assert" ) diff --git a/pkg/resolution/resolver.go b/internal/resolution/resolver.go similarity index 88% rename from pkg/resolution/resolver.go rename to internal/resolution/resolver.go index 2acb8e9b..0767b4b0 100644 --- a/pkg/resolution/resolver.go +++ b/internal/resolution/resolver.go @@ -4,11 +4,11 @@ import ( "os" "path" - "github.com/debricked/cli/pkg/file" - resolutionFile "github.com/debricked/cli/pkg/resolution/file" - "github.com/debricked/cli/pkg/resolution/job" - "github.com/debricked/cli/pkg/resolution/strategy" - "github.com/debricked/cli/pkg/tui" + "github.com/debricked/cli/internal/file" + resolutionFile "github.com/debricked/cli/internal/resolution/file" + "github.com/debricked/cli/internal/resolution/job" + "github.com/debricked/cli/internal/resolution/strategy" + "github.com/debricked/cli/internal/tui" ) type IResolver interface { @@ -115,7 +115,7 @@ func (r Resolver) searchDirs(fileSet map[string]bool, dirs []string, exclusions } for _, fileGroup := range fileGroups.ToSlice() { if fileGroup.HasFile() && !fileGroup.HasLockFiles() { - fileSet[fileGroup.FilePath] = true + fileSet[fileGroup.ManifestFile] = true } } } diff --git a/pkg/resolution/resolver_test.go b/internal/resolution/resolver_test.go similarity index 87% rename from pkg/resolution/resolver_test.go rename to internal/resolution/resolver_test.go index 5b16573f..6cc59bc6 100644 --- a/pkg/resolution/resolver_test.go +++ b/internal/resolution/resolver_test.go @@ -5,15 +5,15 @@ import ( "fmt" "testing" - "github.com/debricked/cli/pkg/file" - "github.com/debricked/cli/pkg/file/testdata" - resolutionFile "github.com/debricked/cli/pkg/resolution/file" - fileTestdata "github.com/debricked/cli/pkg/resolution/file/testdata" - "github.com/debricked/cli/pkg/resolution/job" - jobTestdata "github.com/debricked/cli/pkg/resolution/job/testdata" - - "github.com/debricked/cli/pkg/resolution/strategy" - strategyTestdata "github.com/debricked/cli/pkg/resolution/strategy/testdata" + "github.com/debricked/cli/internal/file" + "github.com/debricked/cli/internal/file/testdata" + resolutionFile "github.com/debricked/cli/internal/resolution/file" + fileTestdata "github.com/debricked/cli/internal/resolution/file/testdata" + "github.com/debricked/cli/internal/resolution/job" + jobTestdata "github.com/debricked/cli/internal/resolution/job/testdata" + + "github.com/debricked/cli/internal/resolution/strategy" + strategyTestdata "github.com/debricked/cli/internal/resolution/strategy/testdata" "github.com/stretchr/testify/assert" ) @@ -137,7 +137,7 @@ func TestResolveDirWithManifestFiles(t *testing.T) { } f := testdata.NewFinderMock() groups := file.Groups{} - groups.Add(file.Group{FilePath: goModFile}) + groups.Add(file.Group{ManifestFile: goModFile}) f.SetGetGroupsReturnMock(groups, nil) r := NewResolver( @@ -162,7 +162,7 @@ func TestResolveDirWithManifestFiles(t *testing.T) { func TestResolveDirWithExclusions(t *testing.T) { f := testdata.NewFinderMock() groups := file.Groups{} - groups.Add(file.Group{FilePath: goModFile}) + groups.Add(file.Group{ManifestFile: goModFile}) f.SetGetGroupsReturnMock(groups, nil) r := NewResolver( @@ -184,7 +184,7 @@ func TestResolveDirWithExclusions(t *testing.T) { func TestResolveHasResolutionErrs(t *testing.T) { f := testdata.NewFinderMock() groups := file.Groups{} - groups.Add(file.Group{FilePath: goModFile}) + groups.Add(file.Group{ManifestFile: goModFile}) f.SetGetGroupsReturnMock(groups, nil) jobErr := errors.New("job-error") diff --git a/pkg/resolution/scheduler.go b/internal/resolution/scheduler.go similarity index 95% rename from pkg/resolution/scheduler.go rename to internal/resolution/scheduler.go index 41facfe4..b8d94968 100644 --- a/pkg/resolution/scheduler.go +++ b/internal/resolution/scheduler.go @@ -5,8 +5,8 @@ import ( "sync" "github.com/chelnak/ysmrr" - "github.com/debricked/cli/pkg/resolution/job" - "github.com/debricked/cli/pkg/tui" + "github.com/debricked/cli/internal/resolution/job" + "github.com/debricked/cli/internal/tui" ) type IScheduler interface { diff --git a/pkg/resolution/scheduler_test.go b/internal/resolution/scheduler_test.go similarity index 93% rename from pkg/resolution/scheduler_test.go rename to internal/resolution/scheduler_test.go index 842de1a9..737c1df3 100644 --- a/pkg/resolution/scheduler_test.go +++ b/internal/resolution/scheduler_test.go @@ -5,8 +5,8 @@ import ( "sort" "testing" - "github.com/debricked/cli/pkg/resolution/job" - "github.com/debricked/cli/pkg/resolution/job/testdata" + "github.com/debricked/cli/internal/resolution/job" + "github.com/debricked/cli/internal/resolution/job/testdata" "github.com/stretchr/testify/assert" ) diff --git a/pkg/resolution/strategy/strategy.go b/internal/resolution/strategy/strategy.go similarity index 63% rename from pkg/resolution/strategy/strategy.go rename to internal/resolution/strategy/strategy.go index ffb7d4e0..4b578402 100644 --- a/pkg/resolution/strategy/strategy.go +++ b/internal/resolution/strategy/strategy.go @@ -1,7 +1,7 @@ package strategy import ( - "github.com/debricked/cli/pkg/resolution/job" + "github.com/debricked/cli/internal/resolution/job" ) type IStrategy interface { diff --git a/pkg/resolution/strategy/strategy_factory.go b/internal/resolution/strategy/strategy_factory.go similarity index 71% rename from pkg/resolution/strategy/strategy_factory.go rename to internal/resolution/strategy/strategy_factory.go index b4814128..4e1c516d 100644 --- a/pkg/resolution/strategy/strategy_factory.go +++ b/internal/resolution/strategy/strategy_factory.go @@ -3,11 +3,11 @@ package strategy import ( "fmt" - "github.com/debricked/cli/pkg/resolution/file" - "github.com/debricked/cli/pkg/resolution/pm/gomod" - "github.com/debricked/cli/pkg/resolution/pm/gradle" - "github.com/debricked/cli/pkg/resolution/pm/maven" - "github.com/debricked/cli/pkg/resolution/pm/pip" + "github.com/debricked/cli/internal/resolution/file" + "github.com/debricked/cli/internal/resolution/pm/gomod" + "github.com/debricked/cli/internal/resolution/pm/gradle" + "github.com/debricked/cli/internal/resolution/pm/maven" + "github.com/debricked/cli/internal/resolution/pm/pip" ) type IFactory interface { diff --git a/pkg/resolution/strategy/strategy_factory_test.go b/internal/resolution/strategy/strategy_factory_test.go similarity index 72% rename from pkg/resolution/strategy/strategy_factory_test.go rename to internal/resolution/strategy/strategy_factory_test.go index bc72bae0..b0987a19 100644 --- a/pkg/resolution/strategy/strategy_factory_test.go +++ b/internal/resolution/strategy/strategy_factory_test.go @@ -3,12 +3,12 @@ package strategy import ( "testing" - "github.com/debricked/cli/pkg/resolution/file" - "github.com/debricked/cli/pkg/resolution/pm/gomod" - "github.com/debricked/cli/pkg/resolution/pm/gradle" - "github.com/debricked/cli/pkg/resolution/pm/maven" - "github.com/debricked/cli/pkg/resolution/pm/pip" - "github.com/debricked/cli/pkg/resolution/pm/testdata" + "github.com/debricked/cli/internal/resolution/file" + "github.com/debricked/cli/internal/resolution/pm/gomod" + "github.com/debricked/cli/internal/resolution/pm/gradle" + "github.com/debricked/cli/internal/resolution/pm/maven" + "github.com/debricked/cli/internal/resolution/pm/pip" + "github.com/debricked/cli/internal/resolution/pm/testdata" "github.com/stretchr/testify/assert" ) diff --git a/pkg/resolution/strategy/testdata/strategy_mock.go b/internal/resolution/strategy/testdata/strategy_mock.go similarity index 84% rename from pkg/resolution/strategy/testdata/strategy_mock.go rename to internal/resolution/strategy/testdata/strategy_mock.go index 80bf1ceb..8982fa74 100644 --- a/pkg/resolution/strategy/testdata/strategy_mock.go +++ b/internal/resolution/strategy/testdata/strategy_mock.go @@ -3,8 +3,8 @@ package testdata import ( "errors" - "github.com/debricked/cli/pkg/resolution/job" - "github.com/debricked/cli/pkg/resolution/job/testdata" + "github.com/debricked/cli/internal/resolution/job" + "github.com/debricked/cli/internal/resolution/job/testdata" ) type StrategyMock struct { diff --git a/pkg/resolution/strategy/testdata/strategy_mock_factory.go b/internal/resolution/strategy/testdata/strategy_mock_factory.go similarity index 83% rename from pkg/resolution/strategy/testdata/strategy_mock_factory.go rename to internal/resolution/strategy/testdata/strategy_mock_factory.go index 8ed1c163..e77d51ef 100644 --- a/pkg/resolution/strategy/testdata/strategy_mock_factory.go +++ b/internal/resolution/strategy/testdata/strategy_mock_factory.go @@ -1,8 +1,8 @@ package testdata import ( - "github.com/debricked/cli/pkg/resolution/file" - "github.com/debricked/cli/pkg/resolution/strategy" + "github.com/debricked/cli/internal/resolution/file" + "github.com/debricked/cli/internal/resolution/strategy" ) type FactoryMock struct{} diff --git a/pkg/resolution/testdata/resolver_mock.go b/internal/resolution/testdata/resolver_mock.go similarity index 87% rename from pkg/resolution/testdata/resolver_mock.go rename to internal/resolution/testdata/resolver_mock.go index c20b7889..9430baf9 100644 --- a/pkg/resolution/testdata/resolver_mock.go +++ b/internal/resolution/testdata/resolver_mock.go @@ -1,8 +1,8 @@ package testdata import ( - "github.com/debricked/cli/pkg/resolution" - "github.com/debricked/cli/pkg/resolution/job" + "github.com/debricked/cli/internal/resolution" + "github.com/debricked/cli/internal/resolution/job" "os" "path/filepath" ) diff --git a/internal/scan/scanner.go b/internal/scan/scanner.go index a3328d89..48ac90d7 100644 --- a/internal/scan/scanner.go +++ b/internal/scan/scanner.go @@ -6,14 +6,14 @@ import ( "os" "path/filepath" - "github.com/debricked/cli/pkg/ci" - "github.com/debricked/cli/pkg/ci/env" - "github.com/debricked/cli/pkg/client" - "github.com/debricked/cli/pkg/file" - "github.com/debricked/cli/pkg/git" - "github.com/debricked/cli/pkg/resolution" - "github.com/debricked/cli/pkg/tui" - "github.com/debricked/cli/pkg/upload" + "github.com/debricked/cli/internal/ci" + "github.com/debricked/cli/internal/ci/env" + "github.com/debricked/cli/internal/client" + "github.com/debricked/cli/internal/file" + "github.com/debricked/cli/internal/git" + "github.com/debricked/cli/internal/resolution" + "github.com/debricked/cli/internal/tui" + "github.com/debricked/cli/internal/upload" "github.com/fatih/color" ) diff --git a/internal/scan/scanner_test.go b/internal/scan/scanner_test.go index 8990f199..4564e778 100644 --- a/internal/scan/scanner_test.go +++ b/internal/scan/scanner_test.go @@ -13,27 +13,27 @@ import ( "strings" "testing" - "github.com/debricked/cli/pkg/ci" - "github.com/debricked/cli/pkg/ci/argo" - "github.com/debricked/cli/pkg/ci/azure" - "github.com/debricked/cli/pkg/ci/bitbucket" - "github.com/debricked/cli/pkg/ci/buildkite" - "github.com/debricked/cli/pkg/ci/circleci" - "github.com/debricked/cli/pkg/ci/env" - "github.com/debricked/cli/pkg/ci/github" - "github.com/debricked/cli/pkg/ci/gitlab" - "github.com/debricked/cli/pkg/ci/travis" - "github.com/debricked/cli/pkg/client" - "github.com/debricked/cli/pkg/client/testdata" - "github.com/debricked/cli/pkg/file" - "github.com/debricked/cli/pkg/git" - "github.com/debricked/cli/pkg/resolution" - resolveTestdata "github.com/debricked/cli/pkg/resolution/testdata" - "github.com/debricked/cli/pkg/upload" + "github.com/debricked/cli/internal/ci" + "github.com/debricked/cli/internal/ci/argo" + "github.com/debricked/cli/internal/ci/azure" + "github.com/debricked/cli/internal/ci/bitbucket" + "github.com/debricked/cli/internal/ci/buildkite" + "github.com/debricked/cli/internal/ci/circleci" + "github.com/debricked/cli/internal/ci/env" + "github.com/debricked/cli/internal/ci/github" + "github.com/debricked/cli/internal/ci/gitlab" + "github.com/debricked/cli/internal/ci/travis" + "github.com/debricked/cli/internal/client" + "github.com/debricked/cli/internal/client/testdata" + "github.com/debricked/cli/internal/file" + "github.com/debricked/cli/internal/git" + "github.com/debricked/cli/internal/resolution" + resolveTestdata "github.com/debricked/cli/internal/resolution/testdata" + "github.com/debricked/cli/internal/upload" "github.com/stretchr/testify/assert" ) -var testdataYarn = filepath.Join("testdata", "yarn") +var testdataNpm = filepath.Join("testdata", "npm") var ciService ci.IService = ci.NewService([]ci.ICi{ argo.Ci{}, @@ -62,14 +62,14 @@ func TestScan(t *testing.T) { t.Skipf("TestScan is skipped due to Windows env") } clientMock := testdata.NewDebClientMock() - addMockedFormatsResponse(clientMock, "yarn\\.lock") + addMockedFormatsResponse(clientMock, "package\\.json") addMockedFileUploadResponse(clientMock) addMockedFinishResponse(clientMock, http.StatusNoContent) addMockedStatusResponse(clientMock, http.StatusOK, 50) addMockedStatusResponse(clientMock, http.StatusOK, 100) scanner := makeScanner(clientMock, nil) - path := testdataYarn + path := testdataNpm repositoryName := path cwd, _ := os.Getwd() // reset working directory that has been manipulated in scanner.Scan @@ -103,7 +103,7 @@ func TestScan(t *testing.T) { "Working directory: /", "cli/internal/scan", "Successfully uploaded", - "yarn.lock\n", + "package.json\n", "Successfully initialized scan\n", "Scanning...", "0% |", @@ -122,7 +122,7 @@ func TestScanFailingMetaObject(t *testing.T) { var debClient client.IDebClient = testdata.NewDebClientMock() scanner := NewDebrickedScanner(&debClient, nil, nil, ciService, nil) cwd, _ := os.Getwd() - path := testdataYarn + path := testdataNpm opts := DebrickedOptions{ Path: path, Exclusions: nil, @@ -148,7 +148,7 @@ func TestScanFailingMetaObject(t *testing.T) { func TestScanFailingNoFiles(t *testing.T) { clientMock := testdata.NewDebClientMock() - addMockedFormatsResponse(clientMock, "yarn\\.lock") + addMockedFormatsResponse(clientMock, "package\\.json") scanner := makeScanner(clientMock, nil) opts := DebrickedOptions{ Path: "", @@ -180,7 +180,7 @@ func TestScanEmptyResult(t *testing.T) { t.Skipf("TestScan is skipped due to Windows env") } clientMock := testdata.NewDebClientMock() - addMockedFormatsResponse(clientMock, "yarn\\.lock") + addMockedFormatsResponse(clientMock, "package\\.json") addMockedFileUploadResponse(clientMock) addMockedFinishResponse(clientMock, http.StatusNoContent) addMockedStatusResponse(clientMock, http.StatusOK, 50) @@ -188,9 +188,9 @@ func TestScanEmptyResult(t *testing.T) { addMockedStatusResponse(clientMock, http.StatusCreated, 0) scanner := makeScanner(clientMock, nil) - path := testdataYarn + path := testdataNpm repositoryName := path - commitName := "testdata/yarn-commit" + commitName := testdataNpm cwd, _ := os.Getwd() // reset working directory that has been manipulated in scanner.Scan defer resetWd(t, cwd) @@ -229,7 +229,7 @@ func TestScanInCiWithPathSet(t *testing.T) { scanner := NewDebrickedScanner(&debClient, nil, nil, ciService, nil) cwd, _ := os.Getwd() defer resetWd(t, cwd) - path := testdataYarn + path := testdataNpm _ = os.Setenv("GITLAB_CI", "gitlab") _ = os.Setenv("CI_PROJECT_DIR", ".") opts := DebrickedOptions{ @@ -245,7 +245,7 @@ func TestScanInCiWithPathSet(t *testing.T) { err := scanner.Scan(opts) assert.ErrorIs(t, git.RepositoryNameError, err) cwd, _ = os.Getwd() - assert.Contains(t, cwd, testdataYarn) + assert.Contains(t, cwd, testdataNpm) } func TestScanWithResolve(t *testing.T) { @@ -265,7 +265,7 @@ func TestScanWithResolve(t *testing.T) { // Clean up resolution must be done before wd reset, otherwise files cannot be deleted defer cleanUpResolution(t, resolverMock) - path := filepath.Join("testdata", "npm") + path := testdataNpm repositoryName := path commitName := "testdata/npm-commit" opts := DebrickedOptions{ @@ -292,9 +292,9 @@ func TestScanWithResolveErr(t *testing.T) { cwd, _ := os.Getwd() defer resetWd(t, cwd) - path := filepath.Join("testdata", "npm") + path := testdataNpm repositoryName := path - commitName := "testdata/npm-commit" + commitName := "testdata/yarn-commit" opts := DebrickedOptions{ Path: path, Resolve: true, @@ -503,12 +503,14 @@ func TestScanServiceDowntime(t *testing.T) { clientMock := testdata.NewDebClientMock() clientMock.SetServiceUp(false) debClient = clientMock + var finder file.IFinder + finder, _ = file.NewFinder(debClient) var ciService ci.IService = ci.NewService(nil) - scanner, _ := NewDebrickedScanner(&debClient, ciService) + scanner := NewDebrickedScanner(&debClient, finder, nil, ciService, nil) - path := testdataYarn + path := testdataNpm repositoryName := path commitName := "testdata/yarn-commit" cwd, _ := os.Getwd() diff --git a/internal/scan/testdata/yarn/package.json b/internal/scan/testdata/npm/package.json similarity index 100% rename from internal/scan/testdata/yarn/package.json rename to internal/scan/testdata/npm/package.json diff --git a/internal/scan/testdata/yarn/yarn.lock b/internal/scan/testdata/yarn/yarn.lock deleted file mode 100644 index bb4db65a..00000000 --- a/internal/scan/testdata/yarn/yarn.lock +++ /dev/null @@ -1,8 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -lodash@^4.17.21: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" - integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== diff --git a/internal/tui/resolution_error_list.go b/internal/tui/resolution_error_list.go index d8b6bf9e..336997bf 100644 --- a/internal/tui/resolution_error_list.go +++ b/internal/tui/resolution_error_list.go @@ -6,7 +6,7 @@ import ( "io" "strings" - "github.com/debricked/cli/pkg/resolution/job" + "github.com/debricked/cli/internal/resolution/job" "github.com/fatih/color" ) diff --git a/internal/tui/resolution_error_list_test.go b/internal/tui/resolution_error_list_test.go index 48d4a2df..4912a384 100644 --- a/internal/tui/resolution_error_list_test.go +++ b/internal/tui/resolution_error_list_test.go @@ -6,8 +6,8 @@ import ( "os" "testing" - "github.com/debricked/cli/pkg/resolution/job" - "github.com/debricked/cli/pkg/resolution/job/testdata" + "github.com/debricked/cli/internal/resolution/job" + "github.com/debricked/cli/internal/resolution/job/testdata" "github.com/stretchr/testify/assert" ) diff --git a/internal/upload/batch.go b/internal/upload/batch.go index 607b130d..89691835 100644 --- a/internal/upload/batch.go +++ b/internal/upload/batch.go @@ -15,10 +15,10 @@ import ( "strings" "time" - "github.com/debricked/cli/pkg/client" - "github.com/debricked/cli/pkg/file" - "github.com/debricked/cli/pkg/git" - "github.com/debricked/cli/pkg/tui" + "github.com/debricked/cli/internal/client" + "github.com/debricked/cli/internal/file" + "github.com/debricked/cli/internal/git" + "github.com/debricked/cli/internal/tui" "github.com/fatih/color" ) diff --git a/internal/upload/uploader_test.go b/internal/upload/uploader_test.go index f1cde7e5..a69ae1d2 100644 --- a/internal/upload/uploader_test.go +++ b/internal/upload/uploader_test.go @@ -30,9 +30,9 @@ func TestUpload(t *testing.T) { var c client.IDebClient = &debClientMock{} uploader, _ := NewUploader(c) metaObject, _ := git.NewMetaObject( - "testdata/yarn", - "testdata/yarn", - "testdata/yarn-commit", + "testdata/npm", + "testdata/npm", + "testdata/npm-commit", "", "", "", @@ -71,9 +71,9 @@ func TestUploadPollingError(t *testing.T) { debClientMock.AddMockUriResponse("/api/1.0/open/ci/upload/status", scanMockRes) uploader, _ := NewUploader(debClientMock) metaObject, _ := git.NewMetaObject( - "testdata/yarn", - "testdata/yarn", - "testdata/yarn-commit", + "testdata/npm", + "testdata/npm", + "testdata/npm-commit", "", "", "", diff --git a/pkg/wire/cli_container.go b/internal/wire/cli_container.go similarity index 82% rename from pkg/wire/cli_container.go rename to internal/wire/cli_container.go index 5d98a7d0..16142201 100644 --- a/pkg/wire/cli_container.go +++ b/internal/wire/cli_container.go @@ -3,16 +3,16 @@ package wire import ( "fmt" - "github.com/debricked/cli/pkg/ci" - "github.com/debricked/cli/pkg/client" - "github.com/debricked/cli/pkg/file" - licenseReport "github.com/debricked/cli/pkg/report/license" - vulnerabilityReport "github.com/debricked/cli/pkg/report/vulnerability" - "github.com/debricked/cli/pkg/resolution" - resolutionFile "github.com/debricked/cli/pkg/resolution/file" - "github.com/debricked/cli/pkg/resolution/strategy" - "github.com/debricked/cli/pkg/scan" - "github.com/debricked/cli/pkg/upload" + "github.com/debricked/cli/internal/ci" + "github.com/debricked/cli/internal/client" + "github.com/debricked/cli/internal/file" + licenseReport "github.com/debricked/cli/internal/report/license" + vulnerabilityReport "github.com/debricked/cli/internal/report/vulnerability" + "github.com/debricked/cli/internal/resolution" + resolutionFile "github.com/debricked/cli/internal/resolution/file" + "github.com/debricked/cli/internal/resolution/strategy" + "github.com/debricked/cli/internal/scan" + "github.com/debricked/cli/internal/upload" "github.com/hashicorp/go-retryablehttp" "sync" diff --git a/pkg/wire/cli_container_test.go b/internal/wire/cli_container_test.go similarity index 100% rename from pkg/wire/cli_container_test.go rename to internal/wire/cli_container_test.go diff --git a/pkg/wire/container.go b/internal/wire/container.go similarity index 100% rename from pkg/wire/container.go rename to internal/wire/container.go diff --git a/pkg/resolution/pm/pm.go b/pkg/resolution/pm/pm.go deleted file mode 100644 index 07858b03..00000000 --- a/pkg/resolution/pm/pm.go +++ /dev/null @@ -1,22 +0,0 @@ -package pm - -import ( - "github.com/debricked/cli/pkg/resolution/pm/gomod" - "github.com/debricked/cli/pkg/resolution/pm/gradle" - "github.com/debricked/cli/pkg/resolution/pm/maven" - "github.com/debricked/cli/pkg/resolution/pm/pip" -) - -type IPm interface { - Name() string - Manifests() []string -} - -func Pms() []IPm { - return []IPm{ - maven.NewPm(), - gradle.NewPm(), - gomod.NewPm(), - pip.NewPm(), - } -} diff --git a/scripts/test_cli.sh b/scripts/test_cli.sh index be3e7e6d..69af57f9 100755 --- a/scripts/test_cli.sh +++ b/scripts/test_cli.sh @@ -4,7 +4,7 @@ RED='\033[0;31m' SET='\033[0m' set -e -go test -cover -coverprofile=coverage.out ./pkg/... +go test -cover -coverprofile=coverage.out ./internal/... echo -e "\nChecking test coverage threshold..." regex='[0-9]+\.*[0-9]*' diff --git a/test/resolve/pip_test.go b/test/resolve/pip_test.go index e9016674..686ad16b 100644 --- a/test/resolve/pip_test.go +++ b/test/resolve/pip_test.go @@ -5,8 +5,8 @@ import ( "path/filepath" "testing" - "github.com/debricked/cli/pkg/cmd/resolve" - "github.com/debricked/cli/pkg/wire" + "github.com/debricked/cli/internal/cmd/resolve" + "github.com/debricked/cli/internal/wire" "github.com/stretchr/testify/assert" )