This file is indexed.

/usr/share/gocode/src/github.com/coreos/go-etcd/etcd/cluster.go is in golang-github-coreos-go-etcd-dev 2.0.0-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package etcd

import (
	"math/rand"
	"strings"
)

type Cluster struct {
	Leader   string   `json:"leader"`
	Machines []string `json:"machines"`
	picked   int
}

func NewCluster(machines []string) *Cluster {
	// if an empty slice was sent in then just assume HTTP 4001 on localhost
	if len(machines) == 0 {
		machines = []string{"http://127.0.0.1:4001"}
	}

	// default leader and machines
	return &Cluster{
		Leader:   "",
		Machines: machines,
		picked:   rand.Intn(len(machines)),
	}
}

func (cl *Cluster) failure()     { cl.picked = rand.Intn(len(cl.Machines)) }
func (cl *Cluster) pick() string { return cl.Machines[cl.picked] }

func (cl *Cluster) updateFromStr(machines string) {
	cl.Machines = strings.Split(machines, ",")
	for i := range cl.Machines {
		cl.Machines[i] = strings.TrimSpace(cl.Machines[i])
	}
	cl.picked = rand.Intn(len(cl.Machines))
}