refactor: use const code block

Signed-off-by: SataQiu <qiushida@beyondcent.com>
pull/5573/head
SataQiu 7 years ago
parent 9dce1ac88b
commit b72265b4f3

@ -33,6 +33,12 @@ import (
"k8s.io/helm/pkg/repo" "k8s.io/helm/pkg/repo"
) )
const (
sep = "\v"
// verSep is a separator for version fields in map keys.
verSep = "$$"
)
// Result is a search result. // Result is a search result.
// //
// Score indicates how close it is to match. The higher the score, the longer // Score indicates how close it is to match. The higher the score, the longer
@ -49,16 +55,11 @@ type Index struct {
charts map[string]*repo.ChartVersion charts map[string]*repo.ChartVersion
} }
const sep = "\v"
// NewIndex creats a new Index. // NewIndex creats a new Index.
func NewIndex() *Index { func NewIndex() *Index {
return &Index{lines: map[string]string{}, charts: map[string]*repo.ChartVersion{}} return &Index{lines: map[string]string{}, charts: map[string]*repo.ChartVersion{}}
} }
// verSep is a separator for version fields in map keys.
const verSep = "$$"
// AddRepo adds a repository index to the search index. // AddRepo adds a repository index to the search index.
func (i *Index) AddRepo(rname string, ind *repo.IndexFile, all bool) { func (i *Index) AddRepo(rname string, ind *repo.IndexFile, all bool) {
ind.SortEntries() ind.SortEntries()

Loading…
Cancel
Save