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

Open
stubbornTanzhe opened this Issue Sep 3, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@stubbornTanzhe

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.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment