On Fri, Oct 16, 2020 at 2:36 PM nilsocket <nilsoc...@gmail.com> wrote:
>
> I was trying to create a package which sanitizes file name, for testing 
> purposes, I choose blns.
>
> I create a directory, named "blns" and sanitize names from blns and create 
> those files in "blns" directory.
>
> I have tested 516 strings in Linux, everything worked fine, for sake of 
> cross-compatibility I choose to test in windows, then I got this problem.
>
> I was able to create 515 files in "blns" directory but this one.
>
> Since You were not able to reproduce, I will consider some kind of problem 
> with windows OS and skip it, as this is error is from windows system calls.

I don't think you understand the earlier comment, so I will restate it.

Your sample code says

    os.MkdirAll(dir, os.ModePerm)

Do not do that.

Instead write

    if err := os.MkdirAll(dir, os.ModePerm); err != nil {
        log.Println(err)
        return
    }

Ian


> On Friday, October 16, 2020 at 8:39:03 AM UTC+5:30 Kurtis Rader wrote:
>>
>> On Thu, Oct 15, 2020 at 8:00 PM nilsocket <nils...@gmail.com> wrote:
>>>
>>> No, dir "a" is being created.
>>
>>
>> Yes, I understand you are trying to create the directory. My point is that 
>> you don't verify that the `os.MkdirAll` call succeeds. On my Windows 10 
>> system your program works fine unless I create a file named "a" before 
>> running your program. Please modify your program to check the error value 
>> returned by `os.MkdirAll` and verify that it is nil.
>>
>>>
>>> Intact, I was testing out big list of naughty strings, I didn't have 
>>> problem with any string but this one.
>>>
>>> Regarding error, I don't mean error is "linked picture", I mean, for error 
>>> one can look at the picture which I have linked.
>>
>>
>> That wasn't obvious at first glance. The indirection also wasn't necessary. 
>> All you had to do was write that the error was something like this (what I 
>> saw when I deliberately induced a failure by running "touch a"):
>>
>> 2020/10/15 19:32:16 open a\408_-IMG 
>> SRC=&#0000106&#0000097&#0000118&#0000097&#0000115&#0000099&#0000
>> 114&#0000105&#0000112&#0000116&#0000058&#0000097&#0000108&#0000101&#0000114&#0000116&#0000040&#00000
>> 39&#0000088&#0000083&#0000083&#0000039&#0000041-: The system cannot find the 
>> path specified.
>>
>> --
>> 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/bf97b64b-b243-4b67-8c7e-d6e7e3895aecn%40googlegroups.com.

-- 
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/CAOyqgcWg0Q1B_BqXtd%3D9LYQf5fTG2nqz0Y%3DtB7bDg%3DR-KVnU2g%40mail.gmail.com.

Reply via email to