komuw / ote

ote updates a packages' go.mod file with a comment next to all dependencies that are test dependencies; identifying them as such.
MIT License
33 stars 0 forks source link

package with sub-packages not rendered correctly #7

Closed komuw closed 3 years ago

komuw commented 4 years ago

For github.com/hashicorp/nomad here is what we get;

ote -r .

module github.com/hashicorp/nomad

go 1.14

replace (
    github.com/Microsoft/go-winio => github.com/endocrimes/go-winio v0.4.13-0.20190628114223-fb47a8b41948
    github.com/NYTimes/gziphandler => github.com/NYTimes/gziphandler v1.0.0
    github.com/apparentlymart/go-textseg/v12 => github.com/apparentlymart/go-textseg/v12 v12.0.0
    github.com/godbus/dbus => github.com/godbus/dbus v5.0.1+incompatible
    github.com/hashicorp/nomad/api => ./api
    github.com/kr/pty => github.com/kr/pty v1.1.5
    github.com/shirou/gopsutil => github.com/hashicorp/gopsutil v2.18.13-0.20200531184148-5aca383d4f9d+incompatible
)

require (
    cloud.google.com/go/storage v1.0.0 // indirect
    contrib.go.opencensus.io/exporter/ocagent v0.4.12 // indirect
    github.com/Azure/azure-sdk-for-go v29.0.0+incompatible // indirect
    github.com/Azure/go-autorest v11.7.1+incompatible // indirect
    github.com/LK4D4/joincontext v0.0.0-20171026170139-1724345da6d5 // test
    github.com/Microsoft/go-winio v0.4.15-0.20200113171025-3fe6c5262873 // test
    github.com/Microsoft/hcsshim v0.8.8-0.20200312192636-fd0797d766b1 // indirect
    github.com/NVIDIA/gpu-monitoring-tools v0.0.0-20180829222009-86f2a9fac6c5 // test
    github.com/NYTimes/gziphandler v1.0.1 // test
    github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e // test
    github.com/armon/go-metrics v0.3.4 // test
    github.com/aws/aws-sdk-go v1.25.41 // test
    github.com/boltdb/bolt v1.3.1 // test
    github.com/checkpoint-restore/go-criu v0.0.0-20190109184317-bdb7599cd87b // indirect
    github.com/cilium/ebpf v0.0.0-20200617135954-7acf5cc039f4 // indirect
    github.com/container-storage-interface/spec v1.2.0-rc1.0.20191021210849-a33ece0a8a9f // test
    github.com/containerd/console v1.0.0 // indirect
    github.com/containerd/go-cni v0.0.0-20190904155053-d20b7eebc7ee // test
    github.com/containernetworking/cni v0.7.2-0.20190612152420-dc953e2fd91f // test
    github.com/containernetworking/plugins v0.7.3-0.20190501191748-2d6d46d308b2 // test
    github.com/coreos/go-iptables v0.4.3-0.20190724151750-969b135e941d // test
    github.com/coreos/go-semver v0.3.0 // test
    github.com/cyphar/filepath-securejoin v0.2.3-0.20190205144030-7efe413b52e1 // indirect
    github.com/docker/cli v0.0.0-20200303215952-eb310fca4956 // test
    github.com/docker/distribution v2.7.1+incompatible // test
    github.com/docker/docker v17.12.0-ce-rc1.0.20200330121334-7f8b4b621b5d+incompatible // test
    github.com/docker/docker-credential-helpers v0.6.2-0.20180719074751-73e5f5dbfea3 // indirect
    github.com/docker/go-units v0.4.0 // test
    github.com/docker/libnetwork v0.8.0-dev.2.0.20200612180813-9e99af28df21 // test
    github.com/dustin/go-humanize v1.0.0 // test
    github.com/elazarl/go-bindata-assetfs v1.0.1-0.20200509193318-234c15e7648f // test
    github.com/fatih/color v1.9.0 // test
    github.com/fsnotify/fsnotify v1.4.9 // indirect
    github.com/fsouza/go-dockerclient v1.6.5 // test
    github.com/golang/protobuf v1.3.4 // test
    github.com/golang/snappy v0.0.1 // test
    github.com/google/go-cmp v0.4.0 // test
    github.com/gorilla/websocket v1.4.2 // test
    github.com/grpc-ecosystem/go-grpc-middleware v1.2.1-0.20200228141219-3ce3d519df39 // test
    github.com/grpc-ecosystem/grpc-gateway v1.9.0 // indirect
    github.com/hashicorp/consul v1.7.1-0.20200213195527-b137060630b4 // test
    github.com/hashicorp/consul-template v0.24.1 // test
    github.com/hashicorp/consul/api v1.4.1-0.20200730220852-12f574c9de39 // test
    github.com/hashicorp/consul/sdk v0.5.0 // test
    github.com/hashicorp/cronexpr v1.1.0 // test
    github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de // test
    github.com/hashicorp/go-cleanhttp v0.5.1 // test
    github.com/hashicorp/go-connlimit v0.2.0 // test
    github.com/hashicorp/go-discover v0.0.0-20200108194735-7698de1390a1 // test
    github.com/hashicorp/go-envparse v0.0.0-20180119215841-310ca1881b22 // test
    github.com/hashicorp/go-getter v1.3.1-0.20190822194507-f5101da01173 // test
    github.com/hashicorp/go-hclog v0.12.0 // test
    github.com/hashicorp/go-immutable-radix v1.2.0 // test
    github.com/hashicorp/go-memdb v1.2.1 // test
    github.com/hashicorp/go-msgpack v1.1.5 // test
    github.com/hashicorp/go-multierror v1.1.0 // test
    github.com/hashicorp/go-plugin v1.0.2-0.20191004171845-809113480b55 // test
    github.com/hashicorp/go-sockaddr v1.0.2 // test
    github.com/hashicorp/go-syslog v1.0.0 // test
    github.com/hashicorp/go-uuid v1.0.1 // test
    github.com/hashicorp/go-version v1.2.1-0.20191009193637-2046c9d0f0b0 // test
    github.com/hashicorp/golang-lru v0.5.4 // test
    github.com/hashicorp/hcl v1.0.1-0.20191016231534-914dc3f8dd7c // test
    github.com/hashicorp/hcl/v2 v2.5.1 // test
    github.com/hashicorp/logutils v1.0.0 // test
    github.com/hashicorp/memberlist v0.2.2 // test
    github.com/hashicorp/net-rpc-msgpackrpc v0.0.0-20151116020338-a14192a58a69 // test
    github.com/hashicorp/nomad/api v0.0.0-20200529203653-c4416b26d3eb // test
    github.com/hashicorp/raft v1.1.3-0.20200211192230-365023de17e6 // test
    github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea // test
    github.com/hashicorp/serf v0.9.3 // test
    github.com/hashicorp/vault/api v1.0.5-0.20190730042357-746c0b111519 // test
    github.com/hashicorp/vault/sdk v0.1.14-0.20190730042320-0dc007d98cc8 // test
    github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // test
    github.com/hpcloud/tail v1.0.1-0.20170814160653-37f427138745 // test
    github.com/ishidawataru/sctp v0.0.0-20191218070446-00ab2ac2db07 // indirect
    github.com/joyent/triton-go v0.0.0-20190112182421-51ffac552869 // indirect
    github.com/kr/pretty v0.2.0 // test
    github.com/kr/pty v1.1.5 // test
    github.com/kr/text v0.2.0 // test
    github.com/mattn/go-colorable v0.1.6
    github.com/mitchellh/cli v1.1.0
    github.com/mitchellh/colorstring v0.0.0-20150917214807-8631ce90f286 // test
    github.com/mitchellh/copystructure v1.0.0 // test
    github.com/mitchellh/go-ps v0.0.0-20190716172923-621e5597135b // test
    github.com/mitchellh/go-testing-interface v1.0.0 // test
    github.com/mitchellh/hashstructure v1.0.0 // test
    github.com/mitchellh/mapstructure v1.3.1 // test
    github.com/mrunalp/fileutils v0.0.0-20171103030105-7d4729fb3618 // indirect
    github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
    github.com/oklog/run v1.0.1-0.20180308005104-6934b124db28 // indirect
    github.com/onsi/ginkgo v1.12.0 // test
    github.com/onsi/gomega v1.9.0 // test
    github.com/opencontainers/runc v1.0.0-rc90 // test
    github.com/opencontainers/runtime-spec v1.0.2-0.20200307132014-f49fed0d6290 // indirect
    github.com/opencontainers/selinux v1.4.1-0.20200311111634-a2f0d9c2aafc // indirect
    github.com/pkg/errors v0.9.1 // test
    github.com/posener/complete v1.2.3 // test
    github.com/prometheus/client_golang v1.4.0 // test
    github.com/prometheus/common v0.9.1 // test
    github.com/rs/cors v0.0.0-20170801073201-eabcc6af4bbe // test
    github.com/ryanuber/columnize v2.1.1-0.20170703205827-abc90934186a+incompatible // test
    github.com/ryanuber/go-glob v1.0.0 // test
    github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529
    github.com/seccomp/libseccomp-golang v0.9.2-0.20200314001724-bdab42bd5128 // indirect
    github.com/shirou/gopsutil v2.20.2+incompatible // test
    github.com/sirupsen/logrus v1.6.0 // indirect
    github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c // test
    github.com/stretchr/objx v0.2.0 // indirect
    github.com/stretchr/testify v1.5.1 // test
    github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2 // test
    github.com/vishvananda/netlink v1.1.0 // indirect
    github.com/zclconf/go-cty v1.4.1 // test
    go.opencensus.io v0.22.1-0.20190713072201-b4a14686f0a9 // indirect
    golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37
    golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136 // indirect
    golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f // indirect
    golang.org/x/mod v0.3.0 // indirect
    golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e // test
    golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
    golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a // test
    golang.org/x/sys v0.0.0-20200523222454-059865788121 // test
    golang.org/x/text v0.3.3-0.20200306154105-06d492aade88 // indirect
    golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // test
    golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375 // indirect
    google.golang.org/api v0.13.0 // indirect
    google.golang.org/genproto v0.0.0-20200302123026-7795fca6ccb1 // indirect
    google.golang.org/grpc v1.27.1 // test
    gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
    gopkg.in/square/go-jose.v2 v2.4.1 // indirect
    gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // test
    gopkg.in/tomb.v2 v2.0.0-20140626144623-14b3d72120e8 // test
    gopkg.in/yaml.v2 v2.3.0 // indirect
    gotest.tools/v3 v3.0.2 // indirect
    honnef.co/go/tools v0.0.1-2020.1.4 // indirect
)

ote has labeled joincontext as a test depedency; github.com/LK4D4/joincontext v0.0.0-20171026170139-1724345da6d5 // test.

However, that package appears to be used in non-test files: https://github.com/hashicorp/nomad/search?q=joincontext&unscoped_q=joincontext

komuw commented 4 years ago

If we print impPaths; https://github.com/komuw/ote/blob/0ea16ef3f87071e394e0fbd4392efc427975a0a0/ote.go#L113-L116 while running ote in hashicorp/nomad we get;

[
fmt 
io 
golang.org/x/crypto/ssh/terminal 
github.com/hashicorp/nomad/drivers/shared/executor 
github.com/mitchellh/cli bytes 
github.com/hashicorp/nomad/client/logmon 
strings 
github.com/hashicorp/nomad/version 
github.com/sean-/seed 
github.com/hashicorp/nomad/drivers/docker/docklog 
text/tabwriter 
github.com/hashicorp/nomad/command 
sort 
os 
github.com/mattn/go-colorable
]

In the list of imports above are sub-packages of hashicorp/nomad like github.com/hashicorp/nomad/client/logmon, github.com/hashicorp/nomad/command, github.com/hashicorp/nomad/drivers/shared/executor etc.

We also need to explore this sub-packages and bring out their imports, and then aggregate all the imports of hashicorp/nomad plus all the imports of sub-packages

komuw commented 4 years ago

added a reproducing package in; https://github.com/komuw/ote/compare/issues/7

komuw commented 4 years ago

After merging https://github.com/komuw/ote/commit/95996c2cccde01f278837185df442bf40f0f198d, this seems to be resolved now.
But I need to investigate more and confirm

komuw commented 4 years ago

still seems to be a problem, mod file is now been rendered as;

module github.com/hashicorp/nomad

go 1.14

replace (
    github.com/Microsoft/go-winio => github.com/endocrimes/go-winio v0.4.13-0.20190628114223-fb47a8b41948
    github.com/NYTimes/gziphandler => github.com/NYTimes/gziphandler v1.0.0
    github.com/apparentlymart/go-textseg/v12 => github.com/apparentlymart/go-textseg/v12 v12.0.0
    github.com/godbus/dbus => github.com/godbus/dbus v5.0.1+incompatible
    github.com/hashicorp/nomad/api => ./api
    github.com/kr/pty => github.com/kr/pty v1.1.5
    github.com/shirou/gopsutil => github.com/hashicorp/gopsutil v2.18.13-0.20200531184148-5aca383d4f9d+incompatible
)

require (
    cloud.google.com/go/storage v1.0.0 // indirect
    contrib.go.opencensus.io/exporter/ocagent v0.4.12 // indirect
    github.com/Azure/azure-sdk-for-go v29.0.0+incompatible // indirect
    github.com/Azure/go-autorest v11.7.1+incompatible // indirect
    github.com/LK4D4/joincontext v0.0.0-20171026170139-1724345da6d5
    github.com/Microsoft/go-winio v0.4.15-0.20200113171025-3fe6c5262873
    github.com/Microsoft/hcsshim v0.8.8-0.20200312192636-fd0797d766b1 // indirect
    github.com/NVIDIA/gpu-monitoring-tools v0.0.0-20180829222009-86f2a9fac6c5
    github.com/NYTimes/gziphandler v1.0.1
    github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e
    github.com/armon/go-metrics v0.3.4
    github.com/aws/aws-sdk-go v1.25.41
    github.com/boltdb/bolt v1.3.1
    github.com/checkpoint-restore/go-criu v0.0.0-20190109184317-bdb7599cd87b // indirect
    github.com/cilium/ebpf v0.0.0-20200617135954-7acf5cc039f4 // indirect
    github.com/container-storage-interface/spec v1.2.0-rc1.0.20191021210849-a33ece0a8a9f
    github.com/containerd/console v1.0.0 // indirect
    github.com/containerd/go-cni v0.0.0-20190904155053-d20b7eebc7ee
    github.com/containernetworking/cni v0.7.2-0.20190612152420-dc953e2fd91f
    github.com/containernetworking/plugins v0.7.3-0.20190501191748-2d6d46d308b2
    github.com/coreos/go-iptables v0.4.3-0.20190724151750-969b135e941d
    github.com/coreos/go-semver v0.3.0
    github.com/cyphar/filepath-securejoin v0.2.3-0.20190205144030-7efe413b52e1 // indirect
    github.com/docker/cli v0.0.0-20200303215952-eb310fca4956
    github.com/docker/distribution v2.7.1+incompatible
    github.com/docker/docker v17.12.0-ce-rc1.0.20200330121334-7f8b4b621b5d+incompatible
    github.com/docker/docker-credential-helpers v0.6.2-0.20180719074751-73e5f5dbfea3 // indirect
    github.com/docker/go-units v0.4.0
    github.com/docker/libnetwork v0.8.0-dev.2.0.20200612180813-9e99af28df21
    github.com/dustin/go-humanize v1.0.0
    github.com/elazarl/go-bindata-assetfs v1.0.1-0.20200509193318-234c15e7648f
    github.com/fatih/color v1.9.0
    github.com/fsnotify/fsnotify v1.4.9 // indirect
    github.com/fsouza/go-dockerclient v1.6.5
    github.com/golang/protobuf v1.3.4
    github.com/golang/snappy v0.0.1
    github.com/google/go-cmp v0.4.0
    github.com/gorilla/websocket v1.4.2
    github.com/grpc-ecosystem/go-grpc-middleware v1.2.1-0.20200228141219-3ce3d519df39
    github.com/grpc-ecosystem/grpc-gateway v1.9.0 // indirect
    github.com/hashicorp/consul v1.7.1-0.20200213195527-b137060630b4
    github.com/hashicorp/consul-template v0.24.1
    github.com/hashicorp/consul/api v1.4.1-0.20200730220852-12f574c9de39
    github.com/hashicorp/consul/sdk v0.5.0
    github.com/hashicorp/cronexpr v1.1.0
    github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de
    github.com/hashicorp/go-cleanhttp v0.5.1
    github.com/hashicorp/go-connlimit v0.2.0
    github.com/hashicorp/go-discover v0.0.0-20200108194735-7698de1390a1
    github.com/hashicorp/go-envparse v0.0.0-20180119215841-310ca1881b22
    github.com/hashicorp/go-getter v1.3.1-0.20190822194507-f5101da01173
    github.com/hashicorp/go-hclog v0.12.0
    github.com/hashicorp/go-immutable-radix v1.2.0
    github.com/hashicorp/go-memdb v1.2.1
    github.com/hashicorp/go-msgpack v1.1.5
    github.com/hashicorp/go-multierror v1.1.0
    github.com/hashicorp/go-plugin v1.0.2-0.20191004171845-809113480b55
    github.com/hashicorp/go-sockaddr v1.0.2
    github.com/hashicorp/go-syslog v1.0.0
    github.com/hashicorp/go-uuid v1.0.1
    github.com/hashicorp/go-version v1.2.1-0.20191009193637-2046c9d0f0b0
    github.com/hashicorp/golang-lru v0.5.4
    github.com/hashicorp/hcl v1.0.1-0.20191016231534-914dc3f8dd7c
    github.com/hashicorp/hcl/v2 v2.5.1
    github.com/hashicorp/logutils v1.0.0
    github.com/hashicorp/memberlist v0.2.2
    github.com/hashicorp/net-rpc-msgpackrpc v0.0.0-20151116020338-a14192a58a69
    github.com/hashicorp/nomad/api v0.0.0-20200529203653-c4416b26d3eb
    github.com/hashicorp/raft v1.1.3-0.20200211192230-365023de17e6
    github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea
    github.com/hashicorp/serf v0.9.3
    github.com/hashicorp/vault/api v1.0.5-0.20190730042357-746c0b111519
    github.com/hashicorp/vault/sdk v0.1.14-0.20190730042320-0dc007d98cc8
    github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d
    github.com/hpcloud/tail v1.0.1-0.20170814160653-37f427138745
    github.com/ishidawataru/sctp v0.0.0-20191218070446-00ab2ac2db07 // indirect
    github.com/joyent/triton-go v0.0.0-20190112182421-51ffac552869 // indirect
    github.com/kr/pretty v0.2.0
    github.com/kr/pty v1.1.5
    github.com/kr/text v0.2.0
    github.com/mattn/go-colorable v0.1.6
    github.com/mitchellh/cli v1.1.0
    github.com/mitchellh/colorstring v0.0.0-20150917214807-8631ce90f286
    github.com/mitchellh/copystructure v1.0.0
    github.com/mitchellh/go-ps v0.0.0-20190716172923-621e5597135b
    github.com/mitchellh/go-testing-interface v1.0.0
    github.com/mitchellh/hashstructure v1.0.0
    github.com/mitchellh/mapstructure v1.3.1
    github.com/mrunalp/fileutils v0.0.0-20171103030105-7d4729fb3618 // indirect
    github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
    github.com/oklog/run v1.0.1-0.20180308005104-6934b124db28 // indirect
    github.com/onsi/ginkgo v1.12.0
    github.com/onsi/gomega v1.9.0
    github.com/opencontainers/runc v1.0.0-rc90
    github.com/opencontainers/runtime-spec v1.0.2-0.20200307132014-f49fed0d6290 // indirect
    github.com/opencontainers/selinux v1.4.1-0.20200311111634-a2f0d9c2aafc // indirect
    github.com/pkg/errors v0.9.1
    github.com/posener/complete v1.2.3
    github.com/prometheus/client_golang v1.4.0
    github.com/prometheus/common v0.9.1
    github.com/rs/cors v0.0.0-20170801073201-eabcc6af4bbe
    github.com/ryanuber/columnize v2.1.1-0.20170703205827-abc90934186a+incompatible
    github.com/ryanuber/go-glob v1.0.0
    github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529
    github.com/seccomp/libseccomp-golang v0.9.2-0.20200314001724-bdab42bd5128 // indirect
    github.com/shirou/gopsutil v2.20.2+incompatible
    github.com/sirupsen/logrus v1.6.0 // indirect
    github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c
    github.com/stretchr/objx v0.2.0 // indirect
    github.com/stretchr/testify v1.5.1
    github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2
    github.com/vishvananda/netlink v1.1.0 // indirect
    github.com/zclconf/go-cty v1.4.1
    go.opencensus.io v0.22.1-0.20190713072201-b4a14686f0a9 // indirect
    golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37
    golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136 // indirect
    golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f // indirect
    golang.org/x/mod v0.3.0 // indirect
    golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e
    golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
    golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a
    golang.org/x/sys v0.0.0-20200523222454-059865788121
    golang.org/x/text v0.3.3-0.20200306154105-06d492aade88 // indirect
    golang.org/x/time v0.0.0-20191024005414-555d28b269f0
    golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375 // indirect
    google.golang.org/api v0.13.0 // indirect
    google.golang.org/genproto v0.0.0-20200302123026-7795fca6ccb1 // indirect
    google.golang.org/grpc v1.27.1
    gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
    gopkg.in/square/go-jose.v2 v2.4.1 // indirect
    gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
    gopkg.in/tomb.v2 v2.0.0-20140626144623-14b3d72120e8 // test
    gopkg.in/yaml.v2 v2.3.0 // indirect
    gotest.tools/v3 v3.0.2 // indirect
    honnef.co/go/tools v0.0.1-2020.1.4 // indirect
)

See gopkg.in/tomb.v2 v2.0.0-20140626144623-14b3d72120e8 // test.
but tomb is been used in a non-test file; https://github.com/hashicorp/nomad/blob/c1060b7c45db907c0b633666cc4d8f6baddc5416/nomad/vault.go#L14.

komuw commented 4 years ago

If we print impPaths;

https://github.com/komuw/ote/blob/0ea16ef3f87071e394e0fbd4392efc427975a0a0/ote.go#L113-L116

while running ote in hashicorp/nomad we get;

[
fmt 
io 
golang.org/x/crypto/ssh/terminal 
github.com/hashicorp/nomad/drivers/shared/executor 
github.com/mitchellh/cli bytes 
github.com/hashicorp/nomad/client/logmon 
strings 
github.com/hashicorp/nomad/version 
github.com/sean-/seed 
github.com/hashicorp/nomad/drivers/docker/docklog 
text/tabwriter 
github.com/hashicorp/nomad/command 
sort 
os 
github.com/mattn/go-colorable
]

In the list of imports above are sub-packages of hashicorp/nomad like github.com/hashicorp/nomad/client/logmon, github.com/hashicorp/nomad/command, github.com/hashicorp/nomad/drivers/shared/executor etc.

We also need to explore this sub-packages and bring out their imports, and then aggregate all the imports of hashicorp/nomad plus all the imports of sub-packages

The imports;

[
fmt 
io 
golang.org/x/crypto/ssh/terminal 
github.com/hashicorp/nomad/drivers/shared/executor 
github.com/mitchellh/cli bytes 
github.com/hashicorp/nomad/client/logmon 
strings 
github.com/hashicorp/nomad/version 
github.com/sean-/seed 
github.com/hashicorp/nomad/drivers/docker/docklog 
text/tabwriter 
github.com/hashicorp/nomad/command 
sort 
os 
github.com/mattn/go-colorable
]

are the imports found in https://github.com/hashicorp/nomad/blob/master/main.go; https://github.com/hashicorp/nomad/blob/c1060b7c45db907c0b633666cc4d8f6baddc5416/main.go#L3-L26

As you can see, that file does not import the package github.com/hashicorp/nomad/nomad (https://pkg.go.dev/github.com/hashicorp/nomad/nomad) which is the one that has vault.go, which is the one with the tomb import; https://github.com/hashicorp/nomad/blob/v0.12.3/nomad/vault.go#L14

komuw commented 4 years ago
package main

import (
    "fmt"
        // package exists
    "github.com/hashicorp/nomad/nomad"
)

func main() {
    fmt.Println("nomad.AutopilotRZTag: ", nomad.AutopilotRZTag)
}
komuw commented 4 years ago

An alternative of the implementation done in the linked PR would be: get all the golang files in a project, parse them, get imports .... proceed

That would probably be more performant than the current PR.

komuw commented 3 years ago

After https://github.com/komuw/ote/pull/18; hashicorp/nomad now rendered as;

module github.com/hashicorp/nomad

go 1.16

replace (
    github.com/Microsoft/go-winio => github.com/endocrimes/go-winio v0.4.13-0.20190628114223-fb47a8b41948
    github.com/NYTimes/gziphandler => github.com/NYTimes/gziphandler v1.0.0
    github.com/apparentlymart/go-textseg/v12 => github.com/apparentlymart/go-textseg/v12 v12.0.0
    github.com/godbus/dbus => github.com/godbus/dbus v5.0.1+incompatible
    github.com/golang/protobuf => github.com/golang/protobuf v1.3.4

    github.com/hashicorp/consul/api => github.com/hashicorp/consul/api v1.4.1-0.20210419202301-f265dd635f89
    github.com/hashicorp/go-discover => github.com/hashicorp/go-discover v0.0.0-20200812215701-c4b85f6ed31f
    github.com/hashicorp/hcl => github.com/hashicorp/hcl v1.0.1-0.20201016140508-a07e7d50bbee
    github.com/hashicorp/nomad/api => ./api
    github.com/kr/pty => github.com/kr/pty v1.1.5
)

require (
    cloud.google.com/go/storage v1.0.0 // indirect
    github.com/Azure/go-autorest/autorest v0.11.4 // indirect
    github.com/Azure/go-autorest/autorest/azure/auth v0.5.1 // indirect
    github.com/LK4D4/joincontext v0.0.0-20171026170139-1724345da6d5
    github.com/Microsoft/go-winio v0.4.15-0.20200113171025-3fe6c5262873
    github.com/Microsoft/hcsshim v0.8.8-0.20200312192636-fd0797d766b1 // indirect
    github.com/NVIDIA/gpu-monitoring-tools v0.0.0-20180829222009-86f2a9fac6c5
    github.com/NYTimes/gziphandler v1.0.1
    github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e
    github.com/armon/go-metrics v0.3.4
    github.com/aws/aws-sdk-go v1.38.20
    github.com/boltdb/bolt v1.3.1
    github.com/container-storage-interface/spec v1.4.0
    github.com/containerd/go-cni v0.0.0-20190904155053-d20b7eebc7ee
    github.com/containernetworking/cni v0.7.2-0.20190612152420-dc953e2fd91f
    github.com/containernetworking/plugins v0.7.3-0.20190501191748-2d6d46d308b2
    github.com/coreos/go-iptables v0.4.3-0.20190724151750-969b135e941d
    github.com/coreos/go-semver v0.3.0
    github.com/cyphar/filepath-securejoin v0.2.3-0.20190205144030-7efe413b52e1 // indirect
    github.com/docker/cli v0.0.0-20200303215952-eb310fca4956
    github.com/docker/distribution v2.7.1+incompatible
    github.com/docker/docker v17.12.0-ce-rc1.0.20200330121334-7f8b4b621b5d+incompatible
    github.com/docker/docker-credential-helpers v0.6.2-0.20180719074751-73e5f5dbfea3 // indirect
    github.com/docker/go-units v0.4.0
    github.com/docker/libnetwork v0.8.0-dev.2.0.20200612180813-9e99af28df21
    github.com/dustin/go-humanize v1.0.0
    github.com/elazarl/go-bindata-assetfs v1.0.1-0.20200509193318-234c15e7648f
    github.com/fatih/color v1.9.0
    github.com/fsnotify/fsnotify v1.4.9 // indirect
    github.com/fsouza/go-dockerclient v1.6.5
    github.com/golang/protobuf v1.4.3
    github.com/golang/snappy v0.0.1
    github.com/google/go-cmp v0.5.2 // test
    github.com/gorilla/websocket v1.4.2
    github.com/grpc-ecosystem/go-grpc-middleware v1.2.1-0.20200228141219-3ce3d519df39
    github.com/hashicorp/consul v1.7.8
    github.com/hashicorp/consul-template v0.25.1
    github.com/hashicorp/consul/api v1.8.1
    github.com/hashicorp/consul/sdk v0.7.0 // test
    github.com/hashicorp/cronexpr v1.1.1
    github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de
    github.com/hashicorp/go-cleanhttp v0.5.1
    github.com/hashicorp/go-connlimit v0.3.0
    github.com/hashicorp/go-cty-funcs v0.0.0-20200930094925-2721b1e36840
    github.com/hashicorp/go-discover v0.0.0-20200812215701-c4b85f6ed31f
    github.com/hashicorp/go-envparse v0.0.0-20180119215841-310ca1881b22
    github.com/hashicorp/go-getter v1.5.2
    github.com/hashicorp/go-hclog v0.14.1
    github.com/hashicorp/go-immutable-radix v1.3.0
    github.com/hashicorp/go-memdb v1.3.0
    github.com/hashicorp/go-msgpack v1.1.5
    github.com/hashicorp/go-multierror v1.1.0
    github.com/hashicorp/go-plugin v1.4.0
    github.com/hashicorp/go-sockaddr v1.0.2
    github.com/hashicorp/go-syslog v1.0.0
    github.com/hashicorp/go-uuid v1.0.1
    github.com/hashicorp/go-version v1.2.1-0.20191009193637-2046c9d0f0b0
    github.com/hashicorp/golang-lru v0.5.4
    github.com/hashicorp/hcl v1.0.1-0.20201016140508-a07e7d50bbee
    github.com/hashicorp/hcl/v2 v2.9.2-0.20210407182552-eb14f8319bdc
    github.com/hashicorp/logutils v1.0.0
    github.com/hashicorp/memberlist v0.2.2
    github.com/hashicorp/net-rpc-msgpackrpc v0.0.0-20151116020338-a14192a58a69
    github.com/hashicorp/nomad/api v0.0.0-20200529203653-c4416b26d3eb
    github.com/hashicorp/raft v1.1.3-0.20200211192230-365023de17e6
    github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea
    github.com/hashicorp/serf v0.9.5
    github.com/hashicorp/vault/api v1.0.5-0.20190730042357-746c0b111519
    github.com/hashicorp/vault/sdk v0.1.14-0.20190730042320-0dc007d98cc8 // test
    github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d
    github.com/hpcloud/tail v1.0.1-0.20170814160653-37f427138745
    github.com/ishidawataru/sctp v0.0.0-20191218070446-00ab2ac2db07 // indirect
    github.com/joyent/triton-go v0.0.0-20190112182421-51ffac552869 // indirect
    github.com/kr/pretty v0.2.0
    github.com/kr/pty v1.1.5
    github.com/kr/text v0.2.0
    github.com/mattn/go-colorable v0.1.6
    github.com/mitchellh/cli v1.1.0
    github.com/mitchellh/colorstring v0.0.0-20150917214807-8631ce90f286
    github.com/mitchellh/copystructure v1.0.0
    github.com/mitchellh/go-ps v0.0.0-20190716172923-621e5597135b
    github.com/mitchellh/go-testing-interface v1.0.3
    github.com/mitchellh/hashstructure v1.0.0
    github.com/mitchellh/mapstructure v1.3.3
    github.com/mitchellh/reflectwalk v1.0.1
    github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
    github.com/oklog/run v1.0.1-0.20180308005104-6934b124db28 // indirect
    github.com/onsi/gomega v1.9.0 // indirect
    github.com/opencontainers/runc v1.0.0-rc93
    github.com/opencontainers/runtime-spec v1.0.3-0.20200929063507-e6143ca7d51d
    github.com/pkg/errors v0.9.1
    github.com/posener/complete v1.2.3
    github.com/prometheus/client_golang v1.4.0
    github.com/prometheus/common v0.9.1
    github.com/rs/cors v1.7.0
    github.com/ryanuber/columnize v2.1.1-0.20170703205827-abc90934186a+incompatible
    github.com/ryanuber/go-glob v1.0.0
    github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529
    github.com/seccomp/libseccomp-golang v0.9.2-0.20200314001724-bdab42bd5128 // indirect
    github.com/shirou/gopsutil/v3 v3.21.2
    github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c
    github.com/stretchr/objx v0.2.0 // indirect
    github.com/stretchr/testify v1.6.1
    github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635
    github.com/tklauser/go-sysconf v0.3.5 // indirect
    github.com/zclconf/go-cty v1.8.0
    github.com/zclconf/go-cty-yaml v1.0.2
    go.opencensus.io v0.22.1-0.20190713072201-b4a14686f0a9 // indirect
    golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
    golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136 // indirect
    golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f // indirect
    golang.org/x/mod v0.3.0 // indirect
    golang.org/x/net v0.0.0-20201224014010-6772e930b67b
    golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a
    golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa
    golang.org/x/time v0.0.0-20191024005414-555d28b269f0
    golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375 // indirect
    google.golang.org/api v0.13.0 // indirect
    google.golang.org/genproto v0.0.0-20200302123026-7795fca6ccb1 // indirect
    google.golang.org/grpc v1.27.1
    gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
    gopkg.in/square/go-jose.v2 v2.4.1 // indirect
    gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
    gopkg.in/tomb.v2 v2.0.0-20140626144623-14b3d72120e8
    gopkg.in/yaml.v2 v2.3.0 // indirect
    gotest.tools/v3 v3.0.2 // indirect
    honnef.co/go/tools v0.0.1-2020.1.4 // indirect
)
komuw commented 3 years ago

fixed by https://github.com/komuw/ote/pull/18