github.com/artisanhe/tools@v1.0.1-0.20210607022958-19a8fef2eb04/codegen/loaderx/utils.go (about)

     1  package loaderx
     2  
     3  import (
     4  	"strings"
     5  
     6  	"github.com/artisanhe/tools/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  }