code: func NewCCPackage(chaincodePath string, goPath string) (*resource.CCPackage, error) {
  
  	if chaincodePath == "" {
  		return nil, errors.New("chaincode path must be provided")
  	}
  
  	var projDir string
  	gp := goPath
  	if gp == "" {
  		gp = defaultGoPath()
  		if gp == "" {
  			return nil, errors.New("GOPATH not defined")
  		}
  		logger.Debugf("Default GOPATH=%s", gp)
  	}
  
  	projDir = filepath.Join(gp, "src", chaincodePath)
  
  	logger.Debugf("projDir variable=%s", projDir)
  
  	// We generate the tar in two phases: First grab a list of descriptors,
  	// and then pack them into an archive.  While the two phases aren't
  	// strictly necessary yet, they pave the way for the future where we
  	// will need to assemble sources from multiple packages
  	descriptors, err := findSource(gp, projDir)
  	if err != nil {
  		return nil, err
  	}
  	tarBytes, err := generateTarGz(descriptors)
  	if err != nil {
  		return nil, err
  	}
  
  	ccPkg := &resource.CCPackage{Type: pb.ChaincodeSpec_GOLANG, Code: tarBytes}
  
  	return ccPkg, nil
  }
docs: // NewCCPackage creates new go lang chaincode package