It doesn't modify the `err`, you need to return the result
```
return fmt.Errorf(...)
```

Also, usually error messages start with a lowercase so you can chain them going up the call stack and it doesn't look too terrible.  So something like:

```
return fmt.Errorf("writing to PID file, %v", err)
```