Did you notice the `ls` command reports the file size is 170? The same as
your program? Also, `ls` does not indicate the file is a symlink so the
fact that ioutil.ReadDir presumably behaves the same as os.ReadDir (i.e.,
both use os.Lstat()) that isn't an issue. So for whatever reason the Google
Drive FS is either not reporting the actual size of the file or the file is
really just 170 bytes in length.

On Thu, Oct 5, 2023 at 4:31 PM Mandolyte <cecil....@gmail.com> wrote:

> Here is what I see:
> $ ls -l Household\ Cleaning.gdoc
> -rw-r----- 1 cecil chronos-access 170 Apr 22 15:30 'Household
> Cleaning.gdoc'
> $
>
> I'll update the code to remove the deprecated and see if that is any
> different.
> On Thursday, October 5, 2023 at 6:06:50 PM UTC-4 Kurtis Rader wrote:
>
>> 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 <ceci...@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...@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/69891205-4545-4242-86b5-55485db21276n%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/69891205-4545-4242-86b5-55485db21276n%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%3DD8o4z3jXA8WqGBYXZiwx4oDz7v9vdHA_Mf49n5%2B%3D-iyPg%40mail.gmail.com.

Reply via email to