(fn string)
| 168 | } |
| 169 | |
| 170 | func DetectFieldIdFromFile(fn string) uint64 { |
| 171 | // Read the first 4 bytes of the file |
| 172 | file, err := os.Open(fn) |
| 173 | if err != nil { |
| 174 | panic(err) |
| 175 | } |
| 176 | defer file.Close() |
| 177 | buf := make([]byte, 40) |
| 178 | n, err := file.Read(buf) |
| 179 | if err != nil || n != 40 { |
| 180 | panic(err) |
| 181 | } |
| 182 | in := utils.NewInputBuf(buf) |
| 183 | if in.ReadUint64() != MAGIC { |
| 184 | panic("invalid file header") |
| 185 | } |
| 186 | f := in.ReadBigInt(32) |
| 187 | return field.GetFieldId(field.GetFieldFromOrder(f)) |
| 188 | } |
no test coverage detected