Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: `go mod tidy` does not generate dependency package in go.mod #27465

Closed
stubbornTanzhe opened this Issue Sep 3, 2018 · 3 comments

Comments

Projects
None yet
4 participants
@stubbornTanzhe
Copy link

stubbornTanzhe commented Sep 3, 2018

Please answer these questions before submitting your issue. Thanks!

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

go version go1.11 linux/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="/home/tanzhe/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/tanzhe/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/tanzhe/go/src/git.windimg.com/giantthong/share/go/config/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 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build142383165=/tmp/go-build -gno-record-gcc-switches"

What did you do?

import "github.justaexample.com/namespace/projectname/subpackage"
import a subpackage to define a struct:
type Base struct {
    SubOption    subpackage.Option `yaml:"subpackage_option"`
}

What did you expect to see?

in go.mod,include this:

module github.justaexample.com/namespace/projectnameA

require (
    github.justaexample.com/namespace/projectname v1.0.0
)

and run go test no error

What did you see instead?

when i run go mod tidy,i found
go: finding github.justaexample.com/namespace/projectname/subpackage latest

but no require url with above line,then i run go test,there occur this:

go test -v $(go list ./... | grep -v /vendor/ | fgrep -v github.com/)
go: finding github.justaexample.com/namespace/projectname/subpackage latest
go: finding github.justaexample.com/namespace/projectname/subpackage latest
config/base.go:3:8: unknown import path "github.justaexample.com/namespace/projectname/subpackage": cannot find module providing package github.justaexample.com/namespace/projectname/subpackage

really appreciate for any help

@stubbornTanzhe

This comment has been minimized.

Copy link
Author

stubbornTanzhe commented Sep 3, 2018

btw,github.justaexample.com/namespace/projectname/subpackage is a package url
github.justaexample.com/namespace/projectname is just a program

@oiooj oiooj added the modules label Sep 4, 2018

@bcmills

This comment has been minimized.

Copy link
Member

bcmills commented Jan 17, 2019

Please show a complete example with concrete commands we can run to reproduce the problem.

The error message you posted above suggests that the subpackage does not exist in github.justaexample.com/namespace/projectname v1.0.0, and that (most likely) the test in github.justaexample.com/namespace/projectnameA happens not to import the package containing the erroneous import statement.

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Feb 17, 2019

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this Feb 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.