(f fs.File)
| 1033 | } |
| 1034 | |
| 1035 | func readAll(f fs.File) ([]byte, error) { |
| 1036 | buf := make([]byte, 0, 4*1024) |
| 1037 | tmp := make([]byte, 4*1024) |
| 1038 | for { |
| 1039 | n, err := f.Read(tmp) |
| 1040 | if n > 0 { |
| 1041 | buf = append(buf, tmp[:n]...) |
| 1042 | } |
| 1043 | if err != nil { |
| 1044 | if err.Error() == "EOF" { |
| 1045 | return buf, nil |
| 1046 | } |
| 1047 | return nil, err |
| 1048 | } |
| 1049 | } |
| 1050 | } |
| 1051 | |
| 1052 | // injectBasePathHint splices a `<meta name="zn-base-path" ...>` tag into |
| 1053 | // the SPA shell so the bundled JS can route API calls through the |
no test coverage detected