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.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env)?
Linux amd64
What did you do?
vgo vendoroutside module root
If I call vgo vendor in a subdirectory of a module, the vendor directory is still created in the module root (where go.mod is located). This is certainly intentionally. However, in the case of go command, I might be interested to create a vendor directory just for a command, located in a subdirectoy of a package and module root, eg. to be self-contained for Dockerizing
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered:
@the42 But if you were to create the vendor dir in a subdirectory, the resulting build would behave differently from vgo. Perhaps what you need is to make the command(s) their own module?
Ok, I tried the following:
package (go.mod)
\cmd\service\main.go (here I also created an empty go.mod)
(note: nested go.mod for the command within a go.mod for the package root / module root)
when I run vgo vendor inside package (module root) a vendor directory is created
when I run vgo build ... inside package (module root) the package and the cmd\service gets built
After vgo build ... the contents of package/cmd/service/go.mod becomes
module "github.com/the42/badge"
however no require directives get written. If I execute vgo build inside package/cmd/service I get the following error message:
can't load package: import cycle not allowed
package github.com/the42/badge
imports github.com/the42/badge
import cycle not allowed
package github.com/the42/badge
imports github.com/the42/badge
Also vgo vendor inside package/cmd/service fails with
vgo vendor: open /home/john/src/gocode/src/github.com/the42/badge/cmd/service/vendor/vgo.list: no such file or directory
I guess you meant to completely separate the package from the command, but that way it's no longer nicely encapsulated
rsc
changed the title
x/vgo: Support vendor directories outside module root
x/vgo: allow "vgo vendor" to fill in vendor dir in subdir of module root
Mar 27, 2018
I don't think we're going to do this. The module defines a set of code versions that apply to the whole modules, not to just one subdirectory. "vgo vendor" is about freezing everything for the module, not just one command. The right place for the vendor dir really is the module root, not piecemeal within the module tree.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?Linux amd64
What did you do?
vgo vendor
outside module rootIf I call vgo vendor in a subdirectory of a module, the vendor directory is still created in the module root (where go.mod is located). This is certainly intentionally. However, in the case of go command, I might be interested to create a vendor directory just for a command, located in a subdirectoy of a package and module root, eg. to be self-contained for Dockerizing
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: