tools / godep

dependency tool for go
http://godoc.org/github.com/tools/godep
BSD 3-Clause "New" or "Revised" License
5.54k stars 455 forks source link

Existing directory breaks things #506

Closed netrounds-joakim closed 6 years ago

netrounds-joakim commented 8 years ago

Expected behavior

If the Godeps/ folder already exists, Godeps should just use it and create Godeps.json inside.

Or at least give a friendlier error message explaining why an empty directory is not allowed.

Actual behavior

If the directory Godeps/ exists (and is empty), and I then run godep save I get the following error:

godep: Unable to parse Godeps: read Godeps: is a directory

Steps to reproduce behavior

mkdir Godeps/
godep save

godep version output

godep v74 (linux/amd64/go1.6.2)

go version output

go version go1.6.2 linux/amd64

Contents of Godeps.json file

There is no Godeps.json file when this bug appears.

netrounds-joakim commented 8 years ago

I now see why this happens when I look at the code.

    godepsFile    = filepath.Join("Godeps", "Godeps.json")
    oldGodepsFile = filepath.Join("Godeps")

https://github.com/tools/godep/blob/master/godepfile.go#L14

The old format used a file with the same name as the directory. So one could check if it is a directory first, before trying to read it as a file.

freeformz commented 6 years ago

I am closing this issue because the repo is going to be archived.