Question: My code is working so wrong! After entering and sorting some numbers of list, for some numbers it doesn't work and deletes older node or doesn't show them. Couldn't get what's wrong. 

Sometimes it looks like it is working fine, for example : I entered 4, 6, 7, 2 and it showed truly in the sorted list. but after entering 3 it didn't show 3 in the list.

Here is my code:

```
if(head == NULL)     
{
    head = info;    
    last = info;
    info->next = NULL;   
}
else  
{
    if(info->number > last->number)  
    {
        last->next = info;  
        last = info;            
        info->next = NULL;  
    }
    else if (info->number < head->number ) 
    {          
        info -> next = head;       
        head = info;            
    }

    prev = head;

    for(temp = head-> next ; temp!= NULL; temp = temp->next) 
    {
        prev = prev->next;
        if(info->number >temp->number)
        {
            temp->next = info;                          
        }
        else
        {
            temp-> prev = info;
            info = prev;
        }
    }
}   

```

Answer: 
Simply do:

```
os.RemoveAll("/tmp/")
os.MkdirAll("/tmp/",FileMode)

```
```
func RemoveContents(dir string) error {
    files, err := filepath.Glob(filepath.Join(dir, "*"))
    if err != nil {
        return err
    }
    for _, file := range files {
        err = os.RemoveAll(file)
        if err != nil {
            return err
        }
    }
    return nil
}

```