-
Notifications
You must be signed in to change notification settings - Fork 0
/
read.go
67 lines (49 loc) · 809 Bytes
/
read.go
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
package gopaliwordvfs
import (
"os"
)
func ReadFile(filename string) ([]byte, error) {
content0, ok0 := vfs0[filename]
if ok0 {
return []byte(content0), nil
}
content1, ok1 := vfs1[filename]
if ok1 {
return []byte(content1), nil
}
content2, ok2 := vfs2[filename]
if ok2 {
return []byte(content2), nil
}
content3, ok3 := vfs3[filename]
if ok3 {
return []byte(content3), nil
}
return nil, os.ErrNotExist
}
func MapKeys() []string {
length := 0
length += len(vfs0)
length += len(vfs1)
length += len(vfs2)
length += len(vfs3)
keys := make([]string, length)
i := 0
for k := range vfs0 {
keys[i] = k
i++
}
for k := range vfs1 {
keys[i] = k
i++
}
for k := range vfs2 {
keys[i] = k
i++
}
for k := range vfs3 {
keys[i] = k
i++
}
return keys
}