title: Golang cannot write file into directory
body: <p><strong>Situation:</strong></p>
  
  <p>I'm trying to write a file into a directory, like shown as follows:</p>
  
  <pre><code>func (p *Page) Save() error {
      filepath := DerivePath(p.Title)
      fmt.Println(filepath)
      content, _ := json.MarshalIndent(p, "", "    ")
      err := ioutil.WriteFile(filepath, content, 0600)
      return err
  }
  </code></pre>
  
  <p><strong>Problem:</strong></p>
  
  <p>The following error occurs in line 5:</p>
  
  <blockquote>
    <p>open data/Testpage.json: The system cannot find the path specified.</p>
  </blockquote>
  
  <ul>
  <li>I already tried to create the file before writing with <code>os.Create</code>, but it doesn't work either.</li>
  <li>Loading from the <code>data</code> directory works just fine. Only writing <em>new</em> files into the directory fails.</li>
  </ul>
  
  <p><strong><em>Additional information:</em></strong></p>
  
  <p>My project structure is as follows:</p>
  
  <pre><code>│   .gitignore
  │   .project
  │
  ├───bin
  │       main.exe
  │
  ├───data
  │       Welcome.json
  │
  ├───pkg
  │   └───windows_amd64
  │           page.a
  │
  ├───src
  │   ├───main
  │   │       main.go
  │   │
  │   └───page
  │           page.go
  │           page_test.go
  │
  └───templates
          view.html
  </code></pre>
  
  <p>As mentioned above, <em>reading</em> <code>data/Welcome.json</code> works just fine (by using <code>io/ioutils.ReadFile</code>).
  The source is available on <a href="https://gitlab.com/thyaris/Wiki" rel="nofollow noreferrer">https://gitlab.com/thyaris/Wiki</a>.</p>
  
  <p>Executing <code>D:\GitWorkspaces\Wiki\wiki&gt;go test -v page</code> writes the following output:</p>
  
  <pre><code>=== RUN   TestSave
  data/Testpage.json
  --- FAIL: TestSave (0.00s)
          page_test.go:15: open data/Testpage.json: The system cannot find the path specified.
          page_test.go:19: 'Testpage.json' was not created
  === RUN   TestLoadPage
  --- FAIL: TestLoadPage (0.00s)
          page_test.go:26: Error while loading
          page_test.go:32: File content did not match
  === RUN   TestDelete
  --- PASS: TestDelete (0.00s)
  FAIL
  exit status 1
  FAIL    page    0.094s
  </code></pre>