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: cannot find main module, while building opencontainers/runc #30869

Open
sudeeshjohn opened this Issue Mar 15, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@sudeeshjohn
Copy link

sudeeshjohn commented Mar 15, 2019

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

$ go version
go version devel +cb8054a6b6 Fri Mar 15 04:15:59 2019 +0000 linux/amd64

Does this issue reproduce with the latest release?

No.

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

go env Output
$ go env
go version devel +cb8054a6b6 Fri Mar 15 04:15:59 2019 +0000 linux/amd64
root@ubuntu18:/go/src/github.com/weaveworks/weave# go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/go"
GOPROXY=""
GORACE=""
GOROOT="/go/src/golang/go"
GOTMPDIR=""
GOTOOLDIR="/go/src/golang/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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-build376968183=/tmp/go-build -gno-record-gcc-switches"

What did you do?

git clone https://github.com/opencontainers/runc.git
cd runc
make

What did you expect to see?

make should be successful

What did you see instead?

root@ubuntu18:/go/src/github.com/opencontainers/runc# make
go build -buildmode=pie  -ldflags "-X main.gitCommit="7341c22d46a3de49fe9fdb546f33065296200d99" -X main.version=1.0.0-rc6+dev " -tags "seccomp" -o runc .
go: cannot find main module, but found vendor.conf in /go/src/github.com/opencontainers/runc
	to create a module there, run:
	go mod init
Makefile:33: recipe for target 'runc' failed
make: *** [runc] Error 1
root@ubuntu18:/go/src/github.com/opencontainers/runc#
@katiehockman

This comment has been minimized.

Copy link
Contributor

katiehockman commented Mar 19, 2019

It seems like this is related to #30868
With GO111MODULE=on as the default at tip, that's probably why you're seeing this error now. https://github.com/opencontainers/runc isn't a module, and it looks like the go command is failing to build because it expects one.

/cc @bcmills up to you whether or not you want to mark this as a duplicate of the other issue.

@katiehockman katiehockman changed the title go: cannot find main module, while building runc , weave cmd/go: cannot find main module, while building opencontainers/runc Mar 19, 2019

@bcmills

This comment has been minimized.

Copy link
Member

bcmills commented Mar 28, 2019

This seems like an issue to file against github.com/opencontainers/runc. Fundamentally, if you want to build a module in module mode, then it needs a go.mod file.

What happens if you run the suggested go mod init command?

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.