This file is indexed.

/usr/share/gocode/src/github.com/pkg/sftp/attrs_test.go is in golang-github-pkg-sftp-dev 0.0~git20160930.0.4d0e916-1.

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
package sftp

import (
	"bytes"
	"os"
	"reflect"
	"testing"
	"time"
)

// ensure that attrs implemenst os.FileInfo
var _ os.FileInfo = new(fileInfo)

var unmarshalAttrsTests = []struct {
	b    []byte
	want *fileInfo
	rest []byte
}{
	{marshal(nil, struct{ Flags uint32 }{}), &fileInfo{mtime: time.Unix(int64(0), 0)}, nil},
	{marshal(nil, struct {
		Flags uint32
		Size  uint64
	}{ssh_FILEXFER_ATTR_SIZE, 20}), &fileInfo{size: 20, mtime: time.Unix(int64(0), 0)}, nil},
	{marshal(nil, struct {
		Flags       uint32
		Size        uint64
		Permissions uint32
	}{ssh_FILEXFER_ATTR_SIZE | ssh_FILEXFER_ATTR_PERMISSIONS, 20, 0644}), &fileInfo{size: 20, mode: os.FileMode(0644), mtime: time.Unix(int64(0), 0)}, nil},
	{marshal(nil, struct {
		Flags                 uint32
		Size                  uint64
		UID, GID, Permissions uint32
	}{ssh_FILEXFER_ATTR_SIZE | ssh_FILEXFER_ATTR_UIDGID | ssh_FILEXFER_ATTR_UIDGID | ssh_FILEXFER_ATTR_PERMISSIONS, 20, 1000, 1000, 0644}), &fileInfo{size: 20, mode: os.FileMode(0644), mtime: time.Unix(int64(0), 0)}, nil},
}

func TestUnmarshalAttrs(t *testing.T) {
	for _, tt := range unmarshalAttrsTests {
		stat, rest := unmarshalAttrs(tt.b)
		got := fileInfoFromStat(stat, "")
		tt.want.sys = got.Sys()
		if !reflect.DeepEqual(got, tt.want) || !bytes.Equal(tt.rest, rest) {
			t.Errorf("unmarshalAttrs(%#v): want %#v, %#v, got: %#v, %#v", tt.b, tt.want, tt.rest, got, rest)
		}
	}
}