golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.04k stars 17.54k forks source link

cannot find module providing package #32352

Closed ghost closed 5 years ago

ghost commented 5 years ago

What version of Go are you using (go version)?

$ go version
go version go1.12.4 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64" GOBIN="" GOCACHE="/Users/jj/Library/Caches/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/jj/Documents/golang" GOPROXY="" GORACE="" GOROOT="/usr/local/Cellar/go/1.12.4/libexec" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.12.4/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" CC="clang" CXX="clang++" CGO_ENABLED="0" GOMOD="/Users/jj/Documents/golang/src/github.com/pigeon1990/test/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/zw/dfcvdw3d4935m_4gh2w9txr40000gn/T/go-build445626086=/tmp/go-build -gno-record-gcc-switches -fno-common"

go env Output
$ go env

What did you do?

package main

import (
    "github.com/chihaya/chihaya/bittorrent"
)

func main() {
        fmt.Println(bittorrent.PeerID([20]byte{}))
}

https://play.golang.org/p/1ZJAXLLUPsZ

What did you expect to see?

Compile successfully

What did you see instead?

go build
go: finding github.com/chihaya/chihaya/bittorrent latest
build command-line-arguments: cannot load github.com/chihaya/chihaya/bittorrent: cannot find module providing package github.com/chihaya/chihaya/bittorrent
bcmills commented 5 years ago

The most recent full-release version tag for github.com/chihaya/chihaya is v1.0.2, and that release indeed does not include a bittorrent subpackage.

If you want to use a version newer than the most recent tagged release, you'll need to run go get for that version explicitly.

ghost commented 5 years ago

Thanks a million