github.com/johnnyeven/libtools@v0.0.0-20191126065708-61829c1adf46/codegen/loaderx/utils.go (about)

     1  package loaderx
     2  
     3  import (
     4  	"strings"
     5  
     6  	"github.com/johnnyeven/libtools/codegen"
     7  )
     8  
     9  func GetPkgImportPathAndExpose(s string) (pkgImportPath string, expose string) {
    10  	args := strings.Split(s, ".")
    11  	lenOfArgs := len(args)
    12  	if lenOfArgs > 1 {
    13  		return codegen.DeVendor(strings.Join(args[0:lenOfArgs-1], ".")), args[lenOfArgs-1]
    14  	}
    15  	return "", s
    16  }