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

how to ignore the vendor directory from dependency repos? #29

Open
chenchun opened this issue Jan 20, 2017 · 2 comments
Open

how to ignore the vendor directory from dependency repos? #29

chenchun opened this issue Jan 20, 2017 · 2 comments

Comments

@chenchun
Copy link

chenchun commented Jan 20, 2017

My main repo depens on k8s repo, both my repo and k8s depens on glog. If I don't delete the vendor directory in k8s repo, eg. vendor/k8s.io/kubernetes/vendor/, my program will run into the following error:

./galaxy flag redefined: log_dir
panic: ./galaxy flag redefined: log_dir

goroutine 1 [running]:
panic(0x85c140, 0xc82024a470)
	/usr/local/go/src/runtime/panic.go:481 +0x3e6
flag.(*FlagSet).Var(0xc820058060, 0x7fa71593c1e8, 0xc82024a420, 0x9f2920, 0x7, 0xa90440, 0x2f)
	/usr/local/go/src/flag/flag.go:776 +0x454
flag.(*FlagSet).StringVar(0xc820058060, 0xc82024a420, 0x9f2920, 0x7, 0x0, 0x0, 0xa90440, 0x2f)
	/usr/local/go/src/flag/flag.go:679 +0xc7
flag.(*FlagSet).String(0xc820058060, 0x9f2920, 0x7, 0x0, 0x0, 0xa90440, 0x2f, 0xc82024a410)
	/usr/local/go/src/flag/flag.go:692 +0x83
flag.String(0x9f2920, 0x7, 0x0, 0x0, 0xa90440, 0x2f, 0x7eca7a)
	/usr/local/go/src/flag/flag.go:699 +0x5f
git.code.oa.com/gaiastack/galaxy/vendor/k8s.io/kubernetes/vendor/github.com/golang/glog.init()
	/go/src/git.code.oa.com/gaiastack/galaxy/go/src/git.code.oa.com/gaiastack/galaxy/vendor/k8s.io/kubernetes/vendor/github.com/golang/glog/glog_file.go:41 +0x13e
git.code.oa.com/gaiastack/galaxy/vendor/k8s.io/kubernetes/pkg/util/iptables.init()
	/go/src/git.code.oa.com/gaiastack/galaxy/go/src/git.code.oa.com/gaiastack/galaxy/vendor/k8s.io/kubernetes/pkg/util/iptables/save_restore.go:108 +0x5e
git.code.oa.com/gaiastack/galaxy/pkg/network/portmapping.init()
	/go/src/git.code.oa.com/gaiastack/galaxy/go/src/git.code.oa.com/gaiastack/galaxy/pkg/network/portmapping/iptables.go:269 +0x63
git.code.oa.com/gaiastack/galaxy/pkg/galaxy.init()
	/go/src/git.code.oa.com/gaiastack/galaxy/go/src/git.code.oa.com/gaiastack/galaxy/pkg/galaxy/server.go:161 +0x9c
main.init()
	/go/src/git.code.oa.com/gaiastack/galaxy/go/src/git.code.oa.com/gaiastack/galaxy/cmd/galaxy/galaxy.go:27 +0x45

Here is the output of compiling. glog linked twice from git.code.oa.com/gaiastack/galaxy/vendor/github.com/golang/glog and git.code.oa.com/gaiastack/galaxy/vendor/k8s.io/kubernetes/vendor/github.com/golang/glog.

Building galaxy
git.code.oa.com/gaiastack/galaxy/vendor/github.com/containernetworking/cni/pkg/types
git.code.oa.com/gaiastack/galaxy/vendor/github.com/containernetworking/cni/pkg/version
git.code.oa.com/gaiastack/galaxy/vendor/github.com/containernetworking/cni/pkg/invoke
git.code.oa.com/gaiastack/galaxy/vendor/github.com/containernetworking/cni/pkg/skel
git.code.oa.com/gaiastack/galaxy/pkg/network/flannel
git.code.oa.com/gaiastack/galaxy/vendor/github.com/golang/glog
git.code.oa.com/gaiastack/galaxy/pkg/api/cniutil
git.code.oa.com/gaiastack/galaxy/vendor/github.com/docker/distribution/digest
git.code.oa.com/gaiastack/galaxy/vendor/github.com/docker/distribution/reference
git.code.oa.com/gaiastack/galaxy/vendor/github.com/Sirupsen/logrus
git.code.oa.com/gaiastack/galaxy/vendor/github.com/opencontainers/runc/libcontainer/user
git.code.oa.com/gaiastack/galaxy/vendor/golang.org/x/net/proxy
git.code.oa.com/gaiastack/galaxy/vendor/github.com/docker/go-connections/sockets
git.code.oa.com/gaiastack/galaxy/vendor/github.com/docker/engine-api/client/transport
git.code.oa.com/gaiastack/galaxy/vendor/golang.org/x/net/context
git.code.oa.com/gaiastack/galaxy/vendor/github.com/docker/engine-api/client/transport/cancellable
git.code.oa.com/gaiastack/galaxy/vendor/github.com/docker/engine-api/types/blkiodev
git.code.oa.com/gaiastack/galaxy/vendor/github.com/docker/engine-api/types/strslice
git.code.oa.com/gaiastack/galaxy/vendor/github.com/docker/go-connections/nat
git.code.oa.com/gaiastack/galaxy/vendor/github.com/docker/go-units
git.code.oa.com/gaiastack/galaxy/vendor/github.com/docker/engine-api/types/container
git.code.oa.com/gaiastack/galaxy/vendor/github.com/docker/engine-api/types/versions
git.code.oa.com/gaiastack/galaxy/vendor/github.com/docker/engine-api/types/filters
git.code.oa.com/gaiastack/galaxy/vendor/github.com/docker/engine-api/types/network
git.code.oa.com/gaiastack/galaxy/vendor/github.com/docker/engine-api/types/registry
git.code.oa.com/gaiastack/galaxy/vendor/github.com/docker/engine-api/types
git.code.oa.com/gaiastack/galaxy/vendor/github.com/docker/engine-api/types/reference
git.code.oa.com/gaiastack/galaxy/vendor/github.com/docker/engine-api/types/time
git.code.oa.com/gaiastack/galaxy/vendor/github.com/docker/go-connections/tlsconfig
git.code.oa.com/gaiastack/galaxy/vendor/github.com/docker/engine-api/client
git.code.oa.com/gaiastack/galaxy/pkg/api/docker
git.code.oa.com/gaiastack/galaxy/pkg/api/k8s
git.code.oa.com/gaiastack/galaxy/pkg/api/galaxy
git.code.oa.com/gaiastack/galaxy/vendor/github.com/vishvananda/netns
git.code.oa.com/gaiastack/galaxy/vendor/github.com/vishvananda/netlink/nl
git.code.oa.com/gaiastack/galaxy/vendor/github.com/vishvananda/netlink
git.code.oa.com/gaiastack/galaxy/pkg/flags
git.code.oa.com/gaiastack/galaxy/pkg/wait
git.code.oa.com/gaiastack/galaxy/pkg/gc
git.code.oa.com/gaiastack/galaxy/pkg/network/kernel
git.code.oa.com/gaiastack/galaxy/vendor/k8s.io/kubernetes/vendor/github.com/godbus/dbus
git.code.oa.com/gaiastack/galaxy/vendor/k8s.io/kubernetes/pkg/util/dbus
git.code.oa.com/gaiastack/galaxy/vendor/k8s.io/kubernetes/pkg/util/exec
git.code.oa.com/gaiastack/galaxy/vendor/k8s.io/kubernetes/vendor/github.com/coreos/go-semver/semver
git.code.oa.com/gaiastack/galaxy/vendor/k8s.io/kubernetes/vendor/github.com/golang/glog
git.code.oa.com/gaiastack/galaxy/vendor/k8s.io/kubernetes/pkg/util/sets
git.code.oa.com/gaiastack/galaxy/vendor/k8s.io/kubernetes/pkg/util/iptables
git.code.oa.com/gaiastack/galaxy/pkg/network/portmapping
git.code.oa.com/gaiastack/galaxy/pkg/api/apiswitch
git.code.oa.com/gaiastack/galaxy/pkg/utils/httputils
git.code.oa.com/gaiastack/galaxy/pkg/network/remote
git.code.oa.com/gaiastack/galaxy/vendor/github.com/emicklei/go-restful/log
git.code.oa.com/gaiastack/galaxy/vendor/github.com/emicklei/go-restful
git.code.oa.com/gaiastack/galaxy/pkg/galaxy
git.code.oa.com/gaiastack/galaxy/pkg/signal
git.code.oa.com/gaiastack/galaxy/cmd/galaxy
@chenchun
Copy link
Author

But if I delete vendor/k8s.io/kubernetes/vendor, k8s repo becomes dirty.

chenchun:galaxy (open-2.0.2) $ rm -rf vendor/k8s.io/kubernetes/vendor/
chenchun:galaxy (open-2.0.2) $ git st
git On branch open-2.0.2
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
  (commit or discard the untracked or modified content in submodules)

	modified:   vendor/k8s.io/kubernetes (modified content)

@chenchun
Copy link
Author

I just figure out a way

rm -rf vendor/k8s.io/kubernetes/vendor
git update-index --assume-unchanged vendor/k8s.io/kubernetes
# track the changes again before update a dependency
git update-index --no-assume-unchanged  vendor/k8s.io/kubernetes

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

No branches or pull requests

1 participant