func NewProject(projectName string) *Project {
	if projectName == "" {
		return nil
	}

	p := new(Project)
	p.name = projectName

	// 1. Find already created protect.
	p.absPath = findPackage(projectName)

	// 2. If there are no created project with this path, and user is in GOPATH,
	// then use GOPATH/src/projectName.
	if p.absPath == "" {
		wd, err := os.Getwd()
		if err != nil {
			return nil
		}
		for _, srcPath := range srcPaths {
			goPath := filepath.Dir(srcPath)
			if filepathHasPrefix(wd, goPath) {
				p.absPath = filepath.Join(srcPath, projectName)
				break
			}
		}
	}

	// 3. If user is not in GOPATH, then use (first GOPATH)/src/projectName.
	if p.absPath == "" {
		p.absPath = filepath.Join(srcPaths[0], projectName)
	}

	return p
}
// NewProject returns Project with specified project name.
// If projectName is blank string, it returns nil.
NewProject returns Project with specified project name.
If projectName is blank string, it returns nil.
// NewProject returns Project with specified project name . // If projectName is blank string it returns nil .
func NewProject(projectName string) *Project {
	if projectName == "" {
		return nil
	}
	p := new(Project)
	p.name = projectName
	p.absPath = findPackage(projectName)
	if p.absPath == "" {
		wd, err := os.Getwd()
		if err != nil {
			return nil
		}
		for _, srcPath := range srcPaths {
			goPath := filepath.Dir(srcPath)
			if filepathHasPrefix(wd, goPath) {
				p.absPath = filepath.Join(srcPath, projectName)
				break
			}
		}
	}
	if p.absPath == "" {
		p.absPath = filepath.Join(srcPaths[0], projectName)
	}
	return p
}
func NewProject ( projectName string ) * Project { if projectName == " " { return nil } p := new ( Project ) p . name = projectName p . absPath = findPackage ( projectName ) if p . absPath == " " { wd , err := os . Getwd ( ) if err != nil { return nil } for _ , srcPath := range srcPaths { goPath := filepath . Dir ( srcPath ) if filepathHasPrefix ( wd , goPath ) { p . absPath = filepath . Join ( srcPath , projectName ) break } } } if p . absPath == " " { p . absPath = filepath . Join ( srcPaths [ 0 ] , projectName ) } return p }
NewProject returns Project with specified project name.
NewProject returns Project with specified project name .
// 1. Find already created protect. // 2. If there are no created project with this path, and user is in GOPATH, // then use GOPATH/src/projectName. // 3. If user is not in GOPATH, then use (first GOPATH)/src/projectName.