Thanks for that axel.  I had tried "./" and "/".  I guess I missed one :)
On Sunday, June 20, 2021 at 11:53:03 PM UTC-7 axel.wa...@googlemail.com 
wrote:

> You need to pass "." to `fs.WalkDir`, not "".
>
> On Mon, Jun 21, 2021 at 7:42 AM John <johns...@gmail.com> wrote:
>
>> package main
>>
>> import (
>> "embed"
>> "io/fs"
>> "log"
>> )
>>
>> //go:embed somefile.txt
>> var FS embed.FS
>>
>> func main() {
>>   err := fs.WalkDir(
>>     FS,
>>     "",
>>     func(path string, d fs.DirEntry, err error) error {
>>       log.Println("path: ", path)
>>       return nil
>>     },
>>   )
>>
>>   if err != nil {
>>     log.Println("err: ", err)
>>   }
>> }
>>
>> This will output a single empty long line:
>>
>> 2021/06/20 22:32:29 path:  
>>
>> d comes set to nil, which seems to be a valid condition according to the 
>> docs:
>>
>> *First, if the initial fs.Stat on the root directory fails, WalkDir calls 
>> the function with path set to root, d set to nil, and err set to the error 
>> from fs.Stat.*
>>
>> This seems like an undesirable outcome to be unable to walk the embed.FS, 
>> but I figure maybe it doesn't do so to only allow absolute paths for speed?
>>
>>
>>
>>
>> -- 
>> 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/1b00707c-9f4e-45de-87a8-0cbdda1e2fd4n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/1b00707c-9f4e-45de-87a8-0cbdda1e2fd4n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/53e85c05-9df7-48bc-b080-df7c41f7f81bn%40googlegroups.com.

Reply via email to