sonatype-nexus-community / nancy

A tool to check for vulnerabilities in your Golang dependencies, powered by Sonatype OSS Index
Apache License 2.0
565 stars 75 forks source link

go get failing #18

Closed marct83 closed 3 years ago

marct83 commented 5 years ago

Thanks for creating an issue! Please fill out this form so we can be sure to have all the information we need, and to minimize back and forth.

go get -u github.com/sonatype-nexus-community/nancy

logansam commented 5 years ago

Same problem here!

go version go1.12.7 darwin/amd64

marct83 commented 5 years ago

go version go1.12.6 linux/amd64

DarthHater commented 5 years ago

Interesting! I imagine this is because of the version of Badger it fetches. I'll take a look today!

DarthHater commented 5 years ago

Fails locally for me too, I'll see if I can resolve it today! Thanks for pointing this out.

DarthHater commented 5 years ago

Ok, I know what is causing this. The go get -u is updating dependencies as it you know, downloads them, so we are ending up with a few dependencies that are too new! If you run go get without the u, it should work fine. I'll update the README.md to reflect that, too! Thanks for pointing out the mistake! Close this issue if it works fine for you!

marct83 commented 5 years ago

Same error..

go get github.com/sonatype-nexus-community/nancy
# github.com/sonatype-nexus-community/nancy/audit
audit/auditlog.go:32:15: not enough arguments in call to aurora.Gray
    have (string)
    want (uint8, interface {})
# github.com/sonatype-nexus-community/nancy/ossindex
ossindex/ossindex.go:62:6: opts.Dir undefined (type func(string) badger.Options has no field or method Dir)
ossindex/ossindex.go:63:6: opts.ValueDir undefined (type func(string) badger.Options has no field or method ValueDir)
ossindex/ossindex.go:64:23: cannot use opts (type func(string) badger.Options) as type badger.Options in argument to badger.Open
ossindex/ossindex.go:161:16: txn.SetWithTTL undefined (type *badger.Txn has no field or method SetWithTTL)
DarthHater commented 5 years ago

Interesting. When I do it locally I get: (base) 504 :~ $ go get github.com/sonatype-nexus-community/nancy go: finding github.com/sonatype-nexus-community/nancy v0.0.20 go: downloading github.com/sonatype-nexus-community/nancy v0.0.20 go: extracting github.com/sonatype-nexus-community/nancy v0.0.20

marct83 commented 5 years ago

I wonder if I need to remove the go.sum and then try it again. I will report back

On Tue., Jul. 30, 2019, 11:55 a.m. Jeffry Hesse, notifications@github.com wrote:

Interesting. When I do it locally I get: (base) 504 :~ $ go get github.com/sonatype-nexus-community/nancy go: finding github.com/sonatype-nexus-community/nancy v0.0.20 go: downloading github.com/sonatype-nexus-community/nancy v0.0.20 go: extracting github.com/sonatype-nexus-community/nancy v0.0.20

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sonatype-nexus-community/nancy/issues/18?email_source=notifications&email_token=AEEJ2PWZ5NARLZVMSSHEF2TQCB6AHA5CNFSM4IH5U3LKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3EY3ZQ#issuecomment-516525542, or mute the thread https://github.com/notifications/unsubscribe-auth/AEEJ2PU57NWW2DNKNW4OU63QCB6AHANCNFSM4IH5U3LA .

DarthHater commented 5 years ago

@marct83 are you trying to just get nancy to use it or to develop? I might rework the README a bit to better reflect some options for either. Interested in y'alls use case!

marct83 commented 5 years ago

My Bad. The last comment I made makes no sense. I'm just trying to get nancy. I am planning to implement it into our build process but I need go get to work with it.

On Tue, Jul 30, 2019 at 12:13 PM Jeffry Hesse notifications@github.com wrote:

@marct83 https://github.com/marct83 are you trying to just get nancy to use it or to develop? I might rework the README a bit to better reflect some options for either. Interested in y'alls use case!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sonatype-nexus-community/nancy/issues/18?email_source=notifications&email_token=AEEJ2PV5SQ6DQNDJ3FQ27U3QCCAELA5CNFSM4IH5U3LKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3E2QJA#issuecomment-516532260, or mute the thread https://github.com/notifications/unsubscribe-auth/AEEJ2PQ3EW72OFRCEIIACYLQCCAELANCNFSM4IH5U3LA .

OSSIndex-Admin commented 5 years ago

I am having the same problem on my Ubuntu Xenial (16.04) box. Perhaps I can help debug a bit.

OSSIndex-Admin commented 5 years ago

FYI:

kduck@Gir:~/go/src/github.com/sonatype-nexus-community$ go version
go version go1.13 linux/amd64
zendern commented 5 years ago

@DarthHater I believe this issue can be closed now that #41 was merged.

jroberts07 commented 5 years ago

I am still facing this:

➜  go version
go version go1.13 darwin/amd64
➜  go get github.com/sonatype-nexus-community/nancy
# github.com/sonatype-nexus-community/nancy/ossindex
../../../../go/src/github.com/sonatype-nexus-community/nancy/ossindex/ossindex.go:62:6: opts.Dir undefined (type func(string) badger.Options has no field or method Dir)
../../../../go/src/github.com/sonatype-nexus-community/nancy/ossindex/ossindex.go:63:6: opts.ValueDir undefined (type func(string) badger.Options has no field or method ValueDir)
../../../../go/src/github.com/sonatype-nexus-community/nancy/ossindex/ossindex.go:64:23: cannot use opts (type func(string) badger.Options) as type badger.Options in argument to badger.Open
../../../../go/src/github.com/sonatype-nexus-community/nancy/ossindex/ossindex.go:161:16: txn.SetWithTTL undefined (type *badger.Txn has no field or method SetWithTTL)
➜  
jroberts07 commented 5 years ago

Caused by this breaking change in the latest release of Badger https://github.com/dgraph-io/badger/pull/874/files

DarthHater commented 5 years ago

Hmmmm, it was my understanding that go get <PKG> did not update the dependencies, does it do that? @zendern do you know?

marct83 commented 5 years ago

I'm getting this:

# github.com/golang/dep/gps
../../../go/pkg/mod/github.com/golang/dep@v0.5.4/gps/constraint.go:149:4: undefined: semver.Constraint
# github.com/sonatype-nexus-community/nancy/ossindex
../../../go/pkg/mod/github.com/sonatype-nexus-community/nancy@v0.0.33/ossindex/ossindex.go:62:6: opts.Dir undefined (type func(string) badger.Options has no field or method Dir)
../../../go/pkg/mod/github.com/sonatype-nexus-community/nancy@v0.0.33/ossindex/ossindex.go:63:6: opts.ValueDir undefined (type func(string) badger.Options has no field or method ValueDir)
../../../go/pkg/mod/github.com/sonatype-nexus-community/nancy@v0.0.33/ossindex/ossindex.go:64:23: cannot use opts (type func(string) badger.Options) as type badger.Options in argument to badger.Open
../../../go/pkg/mod/github.com/sonatype-nexus-community/nancy@v0.0.33/ossindex/ossindex.go:161:16: txn.SetWithTTL undefined (type *badger.Txn has no field or method SetWithTTL)
zendern commented 5 years ago

Hmmmm, it was my understanding that go get <PKG> did not update the dependencies, does it do that? @zendern do you know?

So it doesn't update the dependencies but if you haven't had them before in your GOPATH its going to just grab the latest. I'm going to guess that is what happened.

I tested the following.

#wipes out any existing instances of badger depenencies
rm -rf $GOPATH/src/github.com/dgraph-io
#sets GO111MODULE to the default value which is auto
unset GO111MODULE
# see go get fail
go get -v github.com/sonatype-nexus-community/nancy

This blows up with the above error being reported.

#switch to instead having GO111MODULE to on
export GO111MODULE=on
# this should now succeed
go get -v github.com/sonatype-nexus-community/nancy

Now this will respect our go.mod file and make it actually work since its using the correct version of badger. I validated this while using golang 1.13.1 FWIW.

This is probably an instance of us needing to update the README to call out if you want go get to work to with nancy you are going to have to use GO111MODULE=on.

jroberts07 commented 5 years ago

Yep perfect, that solves it