Skip to content

Commit

Permalink
fix: add error detail for package import path detection (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
ginokent authored Aug 14, 2024
2 parents 182a62a + bcedbd4 commit f347d06
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
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

0 comments on commit f347d06

Please sign in to comment.