// modify function to fetch given package.

modify function to fetch given package.
// modify function to fetch given package .
func (ctx *Context) modifyFetch(pkg *Package, uncommitted, hasVersion bool, version string) error {
	vp := ctx.VendorFilePackagePath(pkg.Path)
	if vp == nil {
		vp = &vendorfile.Package{
			Add:  true,
			Path: pkg.Path,
		}
		ctx.VendorFile.Package = append(ctx.VendorFile.Package, vp)
	}
	if hasVersion {
		vp.Version = version
		pkg.Version = version
		pkg.HasVersion = true
	}
	if pkg.IncludeTree {
		vp.Tree = pkg.IncludeTree
	}
	pkg.Origin = strings.TrimPrefix(pkg.Origin, ctx.RootImportPath+"/"+ctx.VendorFolder+"/")
	vp.Origin = pkg.Origin
	origin := vp.Origin
	if len(vp.Origin) == 0 {
		origin = vp.Path
	}
	ps := &pkgspec.Pkg{
		Path:       pkg.Path,
		Origin:     origin,
		HasVersion: hasVersion,
		Version:    version,
	}
	dest := filepath.Join(ctx.RootDir, ctx.VendorFolder, pathos.SlashToFilepath(pkg.Path))
	ctx.Operation = append(ctx.Operation, &Operation{
		Type: OpFetch,
		Pkg:  pkg,
		Src:  ps.String(),
		Dest: dest,
	})
	return nil
}
func ( ctx * Context ) modifyFetch ( pkg * Package , uncommitted , hasVersion bool , version string ) error { vp := ctx . VendorFilePackagePath ( pkg . Path ) if vp == nil { vp = & vendorfile . Package { Add : true , Path : pkg . Path , } ctx . VendorFile . Package = append ( ctx . VendorFile . Package , vp ) } if hasVersion { vp . Version = version pkg . Version = version pkg . HasVersion = true } if pkg . IncludeTree { vp . Tree = pkg . IncludeTree } pkg . Origin = strings . TrimPrefix ( pkg . Origin , ctx . RootImportPath + " " + ctx . VendorFolder + " " ) vp . Origin = pkg . Origin origin := vp . Origin if len ( vp . Origin ) == 0 { origin = vp . Path } ps := & pkgspec . Pkg { Path : pkg . Path , Origin : origin , HasVersion : hasVersion , Version : version , } dest := filepath . Join ( ctx . RootDir , ctx . VendorFolder , pathos . SlashToFilepath ( pkg . Path ) ) ctx . Operation = append ( ctx . Operation , & Operation { Type : OpFetch , Pkg : pkg , Src : ps . String ( ) , Dest : dest , } ) return nil }
modify function to fetch given package.
modify function to fetch given package .