Note that ioutil.ReadDir() has been deprecated since Go 1.16. Which is a very long time. Its documentation is ambiguous but given the behavior you're reporting I would guess it is using the equivalent of os.Lstat() and the "files" you're dealing with are symlinks. Note that os.ReadDir() (which replaced ioutil.ReadDir) explicitly states that is what it does:
Readdir reads the contents of the directory associated with file and returns a slice of up to n FileInfo values, as would be returned by Lstat, in directory order. Subsequent calls on the same file will yield further FileInfos. On Thu, Oct 5, 2023 at 1:35 PM Mandolyte <cecil....@gmail.com> wrote: > Thanks for responding! The entire program may be found here: > https://go.dev/play/p/4kLaeWeQG0Z > > The size comes from os.FileInfo, which is: > > type FileInfo interface { > Name() string <https://pkg.go.dev/builtin#string> // base name of the file > Size() > int64 <https://pkg.go.dev/builtin#int64> // length in bytes for regular > files; system-dependent for others Mode() FileMode > <https://pkg.go.dev/io/fs#FileMode> // file mode bits ModTime() time > <https://pkg.go.dev/time>.Time <https://pkg.go.dev/time#Time> // > modification time IsDir() bool <https://pkg.go.dev/builtin#bool> // > abbreviation for Mode().IsDir() Sys() any <https://pkg.go.dev/builtin#any> // > underlying data source (can return nil) } > > These are collected around line 112 and following. > On Thursday, October 5, 2023 at 1:12:48 PM UTC-4 Kurtis Rader wrote: > >> It would help if you showed us the relevant code. My first guess is those >> files are symlinks. Or perhaps this is simply what Google Drive reports >> when a file is stat()'d. What does `ls -l` show? >> >> On Thu, Oct 5, 2023 at 8:31 AM Mandolyte <ceci...@gmail.com> wrote: >> >>> I have a program that given a starting folder will walk the directory >>> structure and report file sizes and other things. >>> >>> I recently tried to run this code on a mounted Google Drive on ChromeOS >>> Linux. All the google docs report a size 170 bytes. Snippet: >>> >>> [image: Screenshot 2023-10-05 11.29.44 AM.png] >>> >>> Any pointers appreciated! >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "golang-nuts" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to golang-nuts...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/golang-nuts/8faf6106-2fdd-49e3-a193-e8f41605fbffn%40googlegroups.com >>> <https://groups.google.com/d/msgid/golang-nuts/8faf6106-2fdd-49e3-a193-e8f41605fbffn%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> >> >> -- >> Kurtis Rader >> Caretaker of the exceptional canines Junior and Hank >> > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/f00d389d-e55a-4afe-8754-c5acd063c320n%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/f00d389d-e55a-4afe-8754-c5acd063c320n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD-Jh-E93fmYiVdZNj2%3DZEoL5H%2B%3DVvUrKq45JjPTp6huBA%40mail.gmail.com.