Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add error detail for package import path detection #52

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/arcgen/lang/util/package_import_name.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Loading