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: able to build a mono repo? #25281

Closed
aka-mj opened this issue May 7, 2018 · 2 comments
Closed

cmd/go: able to build a mono repo? #25281

aka-mj opened this issue May 7, 2018 · 2 comments
Labels
FrozenDueToAge modules WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@aka-mj
Copy link

aka-mj commented May 7, 2018

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

go version go1.10.1 linux/386 vgo:2018-02-20.1

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

GOARCH="386"
GOBIN=""
GOCACHE="/home/mjohn/.cache/go-build"
GOEXE=""
GOHOSTARCH="386"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/mjohn/workspaces/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_386"
GCCGO="gccgo"
GO386="sse2"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m32 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -gno-record-gcc-switches"
VGOMODROOT=""

What did you do?

I'm curious if the following is possible with vgo, say I have the following project structure, a library with many utilities.

.
├── A
│   ├── a.go
│   └── go.mod
└── cmd
    ├── B
    │   ├── go.mod
    │   └── main.go
    └── C
        ├── go.mod
        └── main.go
❯❯❯ cat A/a.go
package "foo/A"

import "fmt"

func SayHello() {
	fmt.Println("Hello")
}

func SayBye() {
	fmt.Println("Bye")
}
❯❯❯ cat cmd/B/main.go
package main // import "foo/B"

import "foo/A"

func main() {
	A.SayHello()
}
❯❯❯ cat cmd/C/main.go
package main // import "foo/C"

import "foo/A"

func main() {
	A.SayBye()
}
❯❯❯ cat A/go.mod
module "foo/A"
❯❯❯ cat cmd/B/go.mod
module "foo/B"
❯❯❯ cat cmd/C/go.mod
module "foo/C"

If I try to build my utility B, I get an error:

❯❯❯ vgo build cmd/B/main.go
vgo: cannot determine module path for legacy source directory /home/mjohn/workspaces/foo (outside GOROOT, no import comments)

Is it possible to tell vgo that the import it needs is in the same repo?

Thanks.

@gopherbot gopherbot added this to the vgo milestone May 7, 2018
@kardianos
Copy link
Contributor

Probably same vgo bug as #25176. Try to apply linked cl to see if it fixes it.

@bcmills bcmills added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jun 15, 2018
@rsc rsc modified the milestones: vgo, Go1.11 Jul 12, 2018
@rsc rsc added the modules label Jul 12, 2018
@rsc rsc changed the title x/vgo: able to build a mono repo? cmd/go: able to build a mono repo? Jul 12, 2018
@gopherbot
Copy link

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.)

@golang golang locked and limited conversation to collaborators Jul 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants