From bcedbd49f6ce969b5450226eb5b45bab75211e10 Mon Sep 17 00:00:00 2001 From: ginokent <29125616+ginokent@users.noreply.github.com> Date: Wed, 14 Aug 2024 12:35:12 +0900 Subject: [PATCH] fix: add error detail for package import path detection --- internal/arcgen/lang/util/package_import_name.go | 2 +- pkg/errors/errors.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/arcgen/lang/util/package_import_name.go b/internal/arcgen/lang/util/package_import_name.go index abc11d9..2e13e32 100644 --- a/internal/arcgen/lang/util/package_import_name.go +++ b/internal/arcgen/lang/util/package_import_name.go @@ -21,7 +21,7 @@ func DetectPackageImportPath(path string) (string, error) { if pkg.ImportPath == "." { // If ImportPath is ".", it means the directory is not in GOPATH or inside a module - return "", fmt.Errorf("path=%s: %w", absDir, apperr.ErrFailedToDetectPackageImportPath) + return "", fmt.Errorf("path=%s: pkg=%#v: %w", absDir, *pkg, apperr.ErrFailedToDetectPackageImportPath) } return pkg.ImportPath, nil diff --git a/pkg/errors/errors.go b/pkg/errors/errors.go index 85d0377..d4c4f2d 100644 --- a/pkg/errors/errors.go +++ b/pkg/errors/errors.go @@ -8,7 +8,7 @@ import ( var ( ErrLanguageNotSupported = errors.New("language not supported") - ErrFailedToDetectPackageImportPath = errors.New("failed to detect package import path. Please use the --" + config.OptionGoORMStructPackageImportPath + " option") + ErrFailedToDetectPackageImportPath = errors.New("failed to detect package import path. Please use the --" + config.OptionGoORMStructPackageImportPath + " option, or run include the package in your GOPATH or module (GO111MODULE=auto may be required)") ErrSourceFileOrDirectoryIsNotSet = errors.New("source file or directory is not set") ErrInvalidSourceSet = errors.New("invalid source set") ErrGoColumnTagAnnotationNotFoundInSource = errors.New("go-column-tag annotation not found in source")