builder.go
func assembleImportPath(file string) string {
	a, _ := filepath.Abs(filepath.Dir(file))
	absPath, fullPkg := filepath.ToSlash(a), ""
	greedy := 0
	for _, p := range filepath.SplitList(os.Getenv("GOPATH")) {
		a, _ = filepath.Abs(p)
		p = filepath.ToSlash(a)
		symlink, _ := filepath.EvalSymlinks(p)
		if (strings.HasPrefix(absPath, p) || strings.HasPrefix(absPath, symlink)) && len(p) > greedy {
			prefixPath := filepath.ToSlash(filepath.Join(p, "src"))
			fullPkg, _ = filepath.Rel(prefixPath, absPath)
			greedy = len(p)
		}
	}
	return filepath.ToSlash(fullPkg)
}
func assembleImportPath(file string) string {
	a, _ := filepath.Abs(filepath.Dir(file))
	absPath, fullPkg := filepath.ToSlash(a), ""
	greedy := 0
	for _, p := range filepath.SplitList(os.Getenv("GOPATH")) {
		a, _ = filepath.Abs(p)
		p = filepath.ToSlash(a)
		symlink, _ := filepath.EvalSymlinks(p)
		if (strings.HasPrefix(absPath, p) || strings.HasPrefix(absPath, symlink)) && len(p) > greedy {
			prefixPath := filepath.ToSlash(filepath.Join(p, "src"))
			fullPkg, _ = filepath.Rel(prefixPath, absPath)
			greedy = len(p)
		}
	}
	return filepath.ToSlash(fullPkg)
}
func assembleImportPath ( file string ) string { a , _ := filepath . Abs ( filepath . Dir ( file ) ) absPath , fullPkg := filepath . ToSlash ( a ) , " " greedy := 0 for _ , p := range filepath . SplitList ( os . Getenv ( " " ) ) { a , _ = filepath . Abs ( p ) p = filepath . ToSlash ( a ) symlink , _ := filepath . EvalSymlinks ( p ) if ( strings . HasPrefix ( absPath , p ) || strings . HasPrefix ( absPath , symlink ) ) && len ( p ) > greedy { prefixPath := filepath . ToSlash ( filepath . Join ( p , " " ) ) fullPkg , _ = filepath . Rel ( prefixPath , absPath ) greedy = len ( p ) } } return filepath . ToSlash ( fullPkg ) }
// ToSlash is being used to coerce the different
// os PathSeparators into the forward slash
// as the forward slash is required by Go's import statement
ToSlash is being used to coerce the different os PathSeparators into the forward slash as the forward slash is required by Go s import statement