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 · 11 comments
Labels
modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@reitzig
Copy link

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 commented Feb 5, 2021

This seems like a duplicate of #26366.

@reitzig
Copy link
Author

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

@bcmills bcmills added modules WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Feb 5, 2021
@reitzig

This comment has been minimized.

@bcmills

This comment has been minimized.

@reitzig

This comment has been minimized.

@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 minimized.

@bcmills

This comment has been minimized.

@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Apr 5, 2021
@bcmills bcmills added this to the Backlog milestone Apr 5, 2021
@fgergo
Copy link

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

@esimov
Copy link

esimov commented Jul 22, 2022

Are there any updates related to this issue? It seems that there are no activities going on recently addressing this problem. This issue is still happening with go1.18.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants