Hacker News new | ask | show | jobs
by ryanar 1751 days ago
The code uses a 256 byte array to store the file name, and to determine the length of the name it iterates through the array looking for the first 0.

func blen(b [256]byte) int { for i := 0; i < len(b); i++ { if b[i] == 0 { return i } } return len(b) }

Is it not better to use a slice with 256 capacity and access to `len()` than for every file to iterate through the array until you find the end?