junkblocker / codesearch

Fork of Google codesearch with more options
BSD 3-Clause "New" or "Revised" License
46 stars 12 forks source link

Figure out why go get something gets upstream codesearch instead of this fork #9

Closed junkblocker closed 4 years ago

junkblocker commented 4 years ago
Installing codesearch (my codesearch) (github.com/junkblocker/codesearch/cmd/...)
go: found github.com/junkblocker/codesearch/cmd/... in github.com/junkblocker/codesearch v1.1.0
go: finding module for package github.com/google/codesearch/index
go: finding module for package github.com/google/codesearch/regexp
go: found github.com/google/codesearch/regexp in github.com/google/codesearch v1.2.0
SUCCESS.

Somehow google/codesearch/regexp is being considered v1.2.0 and fetched?

Does it depend on GOPROXY being used?

junkblocker commented 4 years ago

GO111MODULE=on go get -u ... causes the problem while GO111MODULE=auto does not.

pcj commented 3 years ago

I'm still seeing this issue

For some reason:

$ cat ~/go/pkg/mod/github.com/junkblocker/codesearch\@v1.2.0/go.mod
module github.com/google/codesearch

go 1.13
$ rm -rf ~/go/pkg/mod/github.com/junkblocker
$ go get -u github.com/junkblocker/codesearch

Puts it back at 1.2.0.

$ GO111MODULE=auto go get github.com/junkblocker/codesearch
go: github.com/junkblocker/codesearch upgrade => v1.2.0
go get: github.com/junkblocker/codesearch@v1.2.0: parsing go.mod:
    module declares its path as: github.com/google/codesearch
            but was required as: github.com/junkblocker/codesearch
$ GO111MODULE=auto go get github.com/junkblocker/codesearch@v5.0.1
go get github.com/junkblocker/codesearch@v5.0.1: github.com/junkblocker/codesearch@v5.0.1: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v5

Finally worked:

$ go get github.com/junkblocker/codesearch@4574186491dc220c3a124b8b01c7b13403680e6e

Perhaps the release version number v5.0.1 and corresponding lack of v5/ subdirectory throws this off? Not sure.

junkblocker commented 3 years ago

This may be because go 1.16 has the new default GO111MOODULE=on . I've updated the README and updated the go.mod to include v6 as the version which hopefully helps.