This file is indexed.

/usr/share/gocode/src/github.com/odeke-em/cache/cache_test.go is in golang-github-odeke-em-cache-dev 0.0~git20151107.0.baf8e436-2.

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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package expirable

import (
	"fmt"
	"path/filepath"
	"strings"

	"testing"
	"time"
)

func parDir(p string) string {
	return filepath.Dir(p)
}

func TestInit(t *testing.T) {
	fmt.Print("testInit")
	store := New()

	manifestStr := `
        /openSrc/node-tika
        /openSrc/Radicale
        /openSrc/rodats
        /openSrc/ical.js
        /openSrc/aws-sdk-js
        /openSrc/dpxdt
        /openSrc/emmodeke-vim-clone
        /openSrc/ytrans.js
        /openSrc/oxy
        /openSrc/drive-js
        /openSrc/git
        /openSrc/ldappy/
        `

	manifest := strings.Split(manifestStr, "\n")

	expiryMs := uint64(25)

	tick := time.Tick(time.Duration(expiryMs))

	manifestCount := len(manifest)

	done := make(chan bool, manifestCount)

	for _, item := range manifest {
		go func(p string) {
			par := parDir(p)
			exp := NewExpirableValueWithOffset(p, expiryMs)

			store.Put(par, exp)
			retr, ok := store.Get(par)

			if retr != exp {
				fmt.Printf("%s encountered a clashing concurrent access %v %v\n", p, retr, exp)
			}

			fmt.Printf("%s still Fresh? %v\n", par, ok)
			done <- true
		}(item)
	}

	for i := 0; i < manifestCount; i++ {
		<-done
	}

	// fmt.Println(store)
	<-tick

	// Now expecting stale changes

	for _, item := range manifest {
		go func(p string) {
			par := parDir(p)
			retr, ok := store.Get(par)

			if ok {
				t.Errorf("%s should have expired", par)
			}

			fmt.Printf("%s Retr: %v still Fresh? %v\n", par, retr)
		}(item)
	}
}