func (i *Index) Remove(path string) (*Entry, error) {
	for index, e := range i.Entries {
		if e.Name == path {
			i.Entries = append(i.Entries[:index], i.Entries[index+1:]...)
			return e, nil
		}
	}
	return nil, ErrEntryNotFound
}
Remove remove the entry that match the give path and returns deleted entry.
package index
import (
	"bytes"
	"errors"
	"fmt"
	"time"
	"gopkg.in/src-d/go-git.v4/plumbing"
	"gopkg.in/src-d/go-git.v4/plumbing/filemode"
)
var (
	ErrUnsupportedVersion = errors.New("unsupported version")
	ErrEntryNotFound = errors.New("entry not found")
	indexSignature          = []byte{'D', 'I', 'R', 'C'}
	treeExtSignature        = []byte{'T', 'R', 'E', 'E'}
	resolveUndoExtSignature = []byte{'R', 'E', 'U', 'C'}
)
type Stage int
const (
	Merged Stage = 1
	AncestorMode Stage = 1
	OurMode Stage = 2
	TheirMode Stage = 3
)
type Index struct {
	Version uint32
	Entries []*Entry
	Cache *Tree
	ResolveUndo *ResolveUndo
}
func (i *Index) Entry(path string) (*Entry, error) {
	for _, e := range i.Entries {
		if e.Name == path {
			return e, nil
		}
	}
	return nil, ErrEntryNotFound
}