Chore: Fix cue imports when we don't use an alias (#61795)

Fix cue imports when we don't use an alias
This commit is contained in:
Selene 2023-01-20 17:04:44 +01:00 committed by GitHub
parent b1efd911c1
commit c1251311d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,7 +64,7 @@ func convertImport(im *ast.ImportSpec) (tsast.ImportSpec, error) {
if im.Name != nil && im.Name.String() != "" {
tsim.AsName = im.Name.String()
} else {
sl := strings.Split(im.Path.Value, "/")
sl := strings.Split(strings.Trim(im.Path.Value, "\""), "/")
final := sl[len(sl)-1]
if idx := strings.Index(final, ":"); idx != -1 {
tsim.AsName = final[idx:]