kisielk / godepgraph

A Go dependency graph visualization tool
MIT License
1.06k stars 90 forks source link

-novendor doesn't working properly #46

Open Antonboom opened 2 years ago

Antonboom commented 2 years ago

Hello!

go env ``` $ go env GO111MODULE="on" GOARCH="arm64" GOBIN="/Users/anthony/golang_workspace/bin" GOCACHE="/Users/anthony/Library/Caches/go-build" GOENV="/Users/anthony/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="arm64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/anthony/golang_workspace/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/anthony/golang_workspace" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64" GOVCS="" GOVERSION="go1.18.2" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/anthony/.../go.mod" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/6t/v80c8sfs5zqf38b2yhzq592h0000gn/T/go-build3004086577=/tmp/go-build -gno-record-gcc-switches -fno-common" ```
 godepgraph -horizontal  -s -novendor ./internal/config | dot -Tpng -o godepgraph.png

godepgraph

$ ls -l vendor/github.com/            
total 0
drwxr-xr-x   3 anthony  staff   96 Aug 15 12:17 BurntSushi
...
drwxr-xr-x   5 anthony  staff  160 Aug 15 12:17 go-playground
...

Expected Behaviour

No vendored packages in the graph.

kelzenberg commented 4 weeks ago

Running godepgraph -h, the description for -novendor states

-novendor ignore packages in the vendor directory

I came across the same problem and reading that, I now believe, that only packages in a vendor directory are being ignored. If true, it's very misleading.

It would be nice to ignore packages based on a regex if excluding external packages is too difficult.