cue/ast/astutil: export ImportPathName
Change-Id: I232dea9a30d789c8eb577875bee8e3e255099a85
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/9461
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Paul Jolly <paul@myitcv.org.uk>
diff --git a/cue/ast/astutil/apply.go b/cue/ast/astutil/apply.go
index fa0572d..8da54fa 100644
--- a/cue/ast/astutil/apply.go
+++ b/cue/ast/astutil/apply.go
@@ -126,7 +126,7 @@
return nil
}
- name := importPathName(importPath)
+ name := ImportPathName(importPath)
// TODO: come up with something much better.
// For instance, hoist the uniquer form cue/export.go to
diff --git a/cue/ast/astutil/util.go b/cue/ast/astutil/util.go
index 2a8ab55..f6f0ec0 100644
--- a/cue/ast/astutil/util.go
+++ b/cue/ast/astutil/util.go
@@ -23,14 +23,14 @@
"cuelang.org/go/cue/token"
)
-// importPathName derives the name from the given import path.
+// ImportPathName derives the package name from the given import path.
//
// Examples:
// string string
// foo.com/bar bar
// foo.com/bar:baz baz
//
-func importPathName(id string) string {
+func ImportPathName(id string) string {
name := path.Base(id)
if p := strings.LastIndexByte(name, ':'); p > 0 {
name = name[p+1:]