Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Commit

Permalink
cue/ast/astutil: export ImportPathName
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mpvl committed Apr 21, 2021
1 parent 6822433 commit 9e34a41
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cue/ast/astutil/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (c *cursor) Import(importPath string) *ast.Ident {
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
Expand Down
4 changes: 2 additions & 2 deletions cue/ast/astutil/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import (
"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:]
Expand Down

0 comments on commit 9e34a41

Please sign in to comment.