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 vendor' should not remove existing non-Go content from the vendor subdirectory #44119

Open
reitzig opened this issue Feb 5, 2021 · 10 comments

Comments

@reitzig
Copy link

@reitzig reitzig commented Feb 5, 2021

Tl;dr: Go is not the only tool I use in my project; I expect it share vendor peacefully.

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

$ go version
go version go1.15.8 linux/amd64

(latest at the time of this writing)

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/raphael/.cache/go-build"
GOENV="/home/raphael/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/raphael/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/raphael/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/raphael/Code/tools/container-do/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-build500284300=/tmp/go-build -gno-record-gcc-switches"

What did you do?

# Gemfile
source "https://rubygems.org"

group :test do
  gem 'cucumber', '~> 5'
  gem 'rspec', '~> 3'
end
# go.mod
module github.com/reitzig/container-do

go 1.15

require (
	github.com/pelletier/go-toml v1.8.1
	go.uber.org/zap v1.16.0
)
bundle2.7 config set --local path 'vendor/bundle'
bundle2.7 install
go mod vendor

What did you expect to see?

Ruby gems and Go modules "installed" in vendor.

What did you see instead?

Only Go modules in vendor.

Workaround

Bundler leaves Go modules alone, so re-running bundle install after go mod vendor creates the desired state.

@mvdan
Copy link
Member

@mvdan mvdan commented Feb 5, 2021

This seems like a duplicate of #26366.

@reitzig
Copy link
Author

@reitzig reitzig commented Feb 5, 2021

Very old and unsolved, but yes, essentially the same issue. Don't know if, after all this time, it refers to the same implementation anymore.

No, that issue is concerned with impact on directories outside of vendor, while my use case is with different tools storing data inside vendor.

@bcmills

This comment has been hidden.

@reitzig

This comment has been hidden.

@bcmills

This comment has been hidden.

@reitzig

This comment has been hidden.

@bcmills bcmills changed the title cmd/go: mod vendor should ignore non-Go content cmd/go: mod vendor should not remove existing non-Go content Mar 22, 2021
@bcmills bcmills changed the title cmd/go: mod vendor should not remove existing non-Go content cmd/go: 'go mod vendor' should not remove existing non-Go content from the vendor subdirectory Mar 22, 2021
@fgergo

This comment has been hidden.

@bcmills

This comment has been hidden.

@bcmills bcmills added this to the Backlog milestone Apr 5, 2021
@fgergo
Copy link

@fgergo fgergo commented Apr 6, 2021

@bcmills @seankhliao I'm not sure current issue title is precise: "cmd/go: 'go mod vendor' should not remove existing non-Go content from the vendor subdirectory"
"go mod vendor" removes everything when it comes to that conclusion without any warning. It removes both go code and other files as well like I described in #45355 .
I believe a title like
"cmd/go: 'go mod vendor' should not remove existing content from the vendor subdirectory without any warning"
describes the situation more precisely.

@reitzig
Copy link
Author

@reitzig reitzig commented Apr 6, 2021

To be clear: my intent was for go mod to leave all files it isn't responsible for in peace. A warning would be good either way, but I don't want it to remove the Ruby files at all! It can do whatever it wants with Go files for all I care since that's its job.

If it insists on completely owning that directory, it needs to be configurable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants