golang / dep

Go dependency management tool experiment (deprecated)
https://golang.github.io/dep/
BSD 3-Clause "New" or "Revised" License
12.86k stars 1.05k forks source link

dep init: pkgtree poisonblack panic due to nil map entry #617

Closed ascandella closed 7 years ago

ascandella commented 7 years ago

Go Version 1.8.1

Architecture Darwin x86_64 (Sierra 10.12.4)

I can consistently reproduce this on https://github.com/uber-go/zap@fab453050a7a08c35f31fc5fff6f2dbd962285ab (tip of master at the time of writing):

Running dep init with the latest master of dep (8bdd9e5cb8e331a8fb505d9c4f62bd58bbac40b3)

zap - master! ❯ dep init -v
dep: Finding dependencies for "github.com/uber-go/zap"...
dep: Found 193 dependencies.
Searching GOPATH for projects...
dep: Building dependency graph...
dep: Found import of "github.com/Sirupsen/logrus", analyzing...
  Using ^0.8.7 as constraint for direct dep github.com/Sirupsen/logrus
  Locking in v0.8.7 (418b41d) for direct dep github.com/Sirupsen/logrus
dep: Found import of "github.com/VividCortex/gohistogram", analyzing...
dep: Could not determine version for "github.com/VividCortex/gohistogram", omitting from generated manifest
dep: Found import of "github.com/afex/hystrix-go/hystrix", analyzing...
dep: Could not determine version for "github.com/afex/hystrix-go", omitting from generated manifest
dep: Found import of "github.com/apache/thrift/lib/go/thrift", analyzing...
  Using cada370 as hint for direct dep github.com/apache/thrift
dep: Found import of "github.com/apex/log", analyzing...
dep: Could not determine version for "github.com/apex/log", omitting from generated manifest
dep: Found import of "github.com/aphistic/golf", analyzing...
dep: Could not determine version for "github.com/aphistic/golf", omitting from generated manifest
dep: Found import of "github.com/aws/aws-sdk-go/aws", analyzing...
  Using master as constraint for direct dep github.com/aws/aws-sdk-go
  Locking in master (64ecfaa) for direct dep github.com/aws/aws-sdk-go
dep: Found import of "github.com/bugsnag/bugsnag-go", analyzing...
dep: Could not determine version for "github.com/bugsnag/bugsnag-go", omitting from generated manifest
dep: Found import of "github.com/cactus/go-statsd-client/statsd", analyzing...
  Using dc93b85 as hint for direct dep github.com/cactus/go-statsd-client
dep: Found import of "github.com/coreos/etcd/client", analyzing...
  Using master as constraint for direct dep github.com/coreos/etcd
  Locking in master (f2a4993) for direct dep github.com/coreos/etcd
dep: Found import of "github.com/davecgh/go-spew/spew", analyzing...
  Using 5215b55 as hint for direct dep github.com/davecgh/go-spew
dep: Found import of "github.com/dgrijalva/jwt-go", analyzing...
dep: Could not determine version for "github.com/dgrijalva/jwt-go", omitting from generated manifest
dep: Found import of "github.com/getsentry/raven-go", analyzing...
  Using c8f8fb7 as hint for direct dep github.com/getsentry/raven-go
dep: Found import of "github.com/go-kit/kit/circuitbreaker", analyzing...
dep: Could not determine version for "github.com/go-kit/kit", omitting from generated manifest
dep: Found import of "github.com/go-logfmt/logfmt", analyzing...
dep: Could not determine version for "github.com/go-logfmt/logfmt", omitting from generated manifest
dep: Found import of "github.com/go-stack/stack", analyzing...
  Using master as constraint for direct dep github.com/go-stack/stack
  Locking in master (100eb0c) for direct dep github.com/go-stack/stack
dep: Found import of "github.com/golang/protobuf/proto", analyzing...
  Using 8df8a93 as hint for direct dep github.com/golang/protobuf
dep: Found import of "github.com/gorilla/mux", analyzing...
  Using master as constraint for direct dep github.com/gorilla/mux
  Locking in master (c9e326e) for direct dep github.com/gorilla/mux
dep: Found import of "github.com/hashicorp/consul/api", analyzing...
  Using master as constraint for direct dep github.com/hashicorp/consul
  Locking in master (71e3901) for direct dep github.com/hashicorp/consul
dep: Found import of "github.com/influxdata/influxdb/client/v2", analyzing...
dep: Could not determine version for "github.com/influxdata/influxdb", omitting from generated manifest
dep: Found import of "github.com/jessevdk/go-flags", analyzing...
  Using master as constraint for direct dep github.com/jessevdk/go-flags
  Locking in master (460c7bb) for direct dep github.com/jessevdk/go-flags
dep: Found import of "github.com/juju/ratelimit", analyzing...
dep: Could not determine version for "github.com/juju/ratelimit", omitting from generated manifest
dep: Found import of "github.com/kr/logfmt", analyzing...
dep: Could not determine version for "github.com/kr/logfmt", omitting from generated manifest
dep: Found import of "github.com/lightstep/lightstep-tracer-go", analyzing...
dep: Could not determine version for "github.com/lightstep/lightstep-tracer-go", omitting from generated manifest
dep: Found import of "github.com/mattn/go-colorable", analyzing...
  Using master as constraint for direct dep github.com/mattn/go-colorable
  Locking in master (d228849) for direct dep github.com/mattn/go-colorable
dep: Found import of "github.com/mattn/go-isatty", analyzing...
  Using master as constraint for direct dep github.com/mattn/go-isatty
  Locking in master (30a891c) for direct dep github.com/mattn/go-isatty
dep: Found import of "github.com/opentracing/opentracing-go", analyzing...
  Using 1b62b0c as hint for direct dep github.com/opentracing/opentracing-go
dep: Found import of "github.com/openzipkin/zipkin-go-opentracing", analyzing...
dep: Could not determine version for "github.com/openzipkin/zipkin-go-opentracing", omitting from generated manifest
dep: Found import of "github.com/pborman/uuid", analyzing...
  Using cccd189 as hint for direct dep github.com/pborman/uuid
dep: Found import of "github.com/performancecopilot/speed", analyzing...
dep: Could not determine version for "github.com/performancecopilot/speed", omitting from generated manifest
dep: Found import of "github.com/pkg/errors", analyzing...
  Using master as constraint for direct dep github.com/pkg/errors
  Locking in master (ff09b13) for direct dep github.com/pkg/errors
dep: Found import of "github.com/pmezard/go-difflib/difflib", analyzing...
  Using e8554b8 as hint for direct dep github.com/pmezard/go-difflib
dep: Found import of "github.com/prometheus/client_golang/prometheus", analyzing...
dep: Could not determine version for "github.com/prometheus/client_golang", omitting from generated manifest
dep: Found import of "github.com/rogpeppe/fastuuid", analyzing...
dep: Could not determine version for "github.com/rogpeppe/fastuuid", omitting from generated manifest
dep: Found import of "github.com/samuel/go-zookeeper/zk", analyzing...
dep: Could not determine version for "github.com/samuel/go-zookeeper", omitting from generated manifest
dep: Found import of "github.com/sirupsen/logrus", analyzing...
  Using ^0.8.7 as constraint for direct dep github.com/sirupsen/logrus
  Locking in v0.8.7 (418b41d) for direct dep github.com/sirupsen/logrus
dep: Found import of "github.com/sony/gobreaker", analyzing...
dep: Could not determine version for "github.com/sony/gobreaker", omitting from generated manifest
dep: Found import of "github.com/streadway/handy/breaker", analyzing...
dep: Could not determine version for "github.com/streadway/handy", omitting from generated manifest
dep: Found import of "github.com/stretchr/objx", analyzing...
  Using 1a9d0bb as hint for direct dep github.com/stretchr/objx
dep: Found import of "github.com/stretchr/testify/assert", analyzing...
  Using e3a8ff8 as hint for direct dep github.com/stretchr/testify
dep: Found import of "github.com/stvp/go-udp-testing", analyzing...
dep: Could not determine version for "github.com/stvp/go-udp-testing", omitting from generated manifest
dep: Found import of "github.com/tj/go-elastic/batch", analyzing...
dep: Could not determine version for "github.com/tj/go-elastic", omitting from generated manifest
dep: Found import of "github.com/tj/go-kinesis", analyzing...
dep: Could not determine version for "github.com/tj/go-kinesis", omitting from generated manifest
dep: Found import of "github.com/tobi/airbrake-go", analyzing...
dep: Could not determine version for "github.com/tobi/airbrake-go", omitting from generated manifest
dep: Found import of "github.com/uber/bark", analyzing...
dep: Could not determine version for "github.com/uber/bark", omitting from generated manifest
dep: Found import of "go.pedge.io/lion", analyzing...
dep: Could not determine version for "go.pedge.io/lion", omitting from generated manifest
dep: Found import of "go.uber.org/atomic", analyzing...
  Using master as constraint for direct dep go.uber.org/atomic
  Locking in master (4e33664) for direct dep go.uber.org/atomic
dep: Found import of "go.uber.org/zap", analyzing...
  Using master as constraint for direct dep go.uber.org/zap
  Locking in master (1550bc0) for direct dep go.uber.org/zap
dep: Found import of "golang.org/x/net/context", analyzing...
  Using 7f88271 as hint for direct dep golang.org/x/net
dep: Found import of "golang.org/x/sys/plan9", analyzing...
  Using master as constraint for direct dep golang.org/x/sys
  Locking in master (a646d33) for direct dep golang.org/x/sys
dep: Found import of "google.golang.org/grpc", analyzing...
dep: Could not determine version for "google.golang.org/grpc", omitting from generated manifest
dep: Found import of "gopkg.in/inconshreveable/log15.v2", analyzing...
dep: Could not determine version for "gopkg.in/inconshreveable/log15.v2", omitting from generated manifest
dep: Found import of "sourcegraph.com/sourcegraph/appdash", analyzing...
dep: Could not determine version for "sourcegraph.com/sourcegraph/appdash", omitting from generated manifest
dep: Analyzing transitive imports...
dep: Analyzing "github.com/go-kit/kit/examples/addsvc/thrift/gen-go/addsvc"...
dep: Analyzing "github.com/go-kit/kit/metrics/expvar"...
dep: Analyzing "github.com/hashicorp/consul/api"...
dep: Analyzing "github.com/hashicorp/go-cleanhttp"...
  Locking in master (ce617e7) for transitive dep github.com/hashicorp/go-cleanhttp
dep: Analyzing "github.com/hashicorp/serf/coordinate"...
  Locking in master (39c7c06) for transitive dep github.com/hashicorp/serf
dep: Analyzing "github.com/influxdata/influxdb/client/v2"...
dep: Analyzing "gopkg.in/inconshreveable/log15.v2"...
dep: Analyzing "github.com/bugsnag/bugsnag-go"...
dep: Analyzing "github.com/go-kit/kit/log/term"...
dep: Analyzing "github.com/go-kit/kit/metrics/dogstatsd"...
dep: Analyzing "github.com/opentracing/opentracing-go/mocktracer"...
dep: Analyzing "github.com/tj/go-elastic/batch"...
dep: Analyzing "go.uber.org/zap"...
dep: Analyzing "go.uber.org/atomic"...
dep: Analyzing "github.com/go-kit/kit/examples/shipping/booking"...
dep: Analyzing "github.com/stretchr/testify/assert"...
dep: Analyzing "github.com/davecgh/go-spew/spew"...
dep: Analyzing "github.com/pmezard/go-difflib/difflib"...
dep: Analyzing "go.uber.org/zap/internal/color"...
dep: Analyzing "go.uber.org/zap/internal/multierror"...
dep: Analyzing "github.com/davecgh/go-spew/spew/testdata"...
dep: Analyzing "github.com/getsentry/raven-go"...
dep: Analyzing "github.com/go-kit/kit/metrics/influx"...
dep: Analyzing "github.com/go-kit/kit/sd"...
dep: Analyzing "github.com/go-kit/kit/transport/grpc"...
dep: Analyzing "github.com/stvp/go-udp-testing"...
dep: Analyzing "github.com/Sirupsen/logrus/hooks/airbrake"...
dep: Analyzing "github.com/tobi/airbrake-go"...
dep: Analyzing "github.com/juju/ratelimit"...
dep: Analyzing "github.com/pborman/uuid"...
dep: Analyzing "sourcegraph.com/sourcegraph/appdash/opentracing"...
dep: Analyzing "github.com/coreos/etcd/client"...
dep: Analyzing "github.com/go-kit/kit/examples/profilesvc"...
dep: Analyzing "github.com/go-kit/kit/examples/shipping/handling"...
dep: Analyzing "github.com/go-kit/kit/sd/lb"...
dep: Analyzing "github.com/opentracing/opentracing-go"...
dep: Analyzing "gopkg.in/inconshreveable/log15.v2/term"...
dep: Analyzing "github.com/aws/aws-sdk-go/aws"...
dep: Analyzing "github.com/go-ini/ini"...
  Locking in master (afbd495) for transitive dep github.com/go-ini/ini
dep: Analyzing "github.com/go-kit/kit/examples/shipping/voyage"...
dep: Analyzing "github.com/go-kit/kit/log/level"...
dep: Analyzing "github.com/go-kit/kit/examples/addsvc/client/thrift"...
dep: Analyzing "github.com/go-kit/kit/transport/httprp"...
dep: Analyzing "github.com/uber/bark/mocks"...
dep: Analyzing "go.uber.org/zap/zaptest/observer"...
dep: Analyzing "gopkg.in/inconshreveable/log15.v2/stack"...
dep: Analyzing "golang.org/x/sys/unix"...
dep: Analyzing "golang.org/x/sys/windows"...
dep: Analyzing "github.com/VividCortex/gohistogram"...
dep: Analyzing "github.com/go-kit/kit/examples/addsvc/client/http"...
dep: Analyzing "github.com/go-kit/kit/examples/shipping/tracking"...
dep: Analyzing "github.com/go-kit/kit/metrics/teststat"...
dep: Analyzing "github.com/go-kit/kit/util/conn"...
dep: Analyzing "golang.org/x/net/context"...
dep: Analyzing "github.com/go-kit/kit/examples/shipping/inspection"...
dep: Analyzing "github.com/go-kit/kit/ratelimit"...
dep: Analyzing "github.com/go-stack/stack"...
dep: Analyzing "github.com/performancecopilot/speed"...
dep: Analyzing "go.uber.org/zap/internal/bufferpool"...
dep: Analyzing "golang.org/x/sys/windows/registry"...
dep: Analyzing "github.com/apex/log/handlers/text"...
dep: Analyzing "github.com/go-kit/kit/tracing/opentracing"...
dep: Analyzing "github.com/golang/protobuf/proto"...
dep: Analyzing "github.com/lightstep/lightstep-tracer-go"...
dep: Analyzing "github.com/pkg/errors"...
dep: Analyzing "github.com/apex/log/handlers/discard"...
dep: Analyzing "github.com/go-kit/kit/metrics/discard"...
dep: Analyzing "github.com/samuel/go-zookeeper/zk"...
dep: Analyzing "golang.org/x/sys/windows/svc/mgr"...
dep: Analyzing "github.com/go-kit/kit/examples/addsvc/pb"...
dep: Analyzing "github.com/jessevdk/go-flags"...
dep: Analyzing "github.com/stretchr/objx"...
dep: Analyzing "go.pedge.io/lion"...
dep: Analyzing "github.com/go-kit/kit/transport/grpc/_grpc_test/pb"...
dep: Analyzing "github.com/stretchr/testify/http"...
dep: Analyzing "golang.org/x/sys/windows/svc/eventlog"...
dep: Analyzing "github.com/go-kit/kit/examples/shipping/cargo"...
dep: Analyzing "github.com/sirupsen/logrus"...
dep: Analyzing "github.com/tj/go-kinesis"...
dep: Analyzing "golang.org/x/sys/windows/svc"...
dep: Analyzing "github.com/aws/aws-sdk-go/service/kinesis"...
dep: Analyzing "github.com/jmespath/go-jmespath"...
  Locking in master (c01cf91) for transitive dep github.com/jmespath/go-jmespath
dep: Analyzing "github.com/go-kit/kit/examples/shipping/routing"...
dep: Analyzing "github.com/stretchr/testify/mock"...
dep: Analyzing "github.com/go-kit/kit/metrics/internal/lv"...
dep: Analyzing "github.com/go-kit/kit/examples/addsvc"...
dep: Analyzing "github.com/go-kit/kit/metrics/graphite"...
dep: Analyzing "github.com/go-kit/kit/metrics/statsd"...
dep: Analyzing "github.com/rogpeppe/fastuuid"...
dep: Analyzing "github.com/stretchr/testify/require"...
dep: Analyzing "go.uber.org/zap/internal/exit"...
dep: Analyzing "github.com/Sirupsen/logrus"...
dep: Analyzing "github.com/apex/log"...
dep: Analyzing "github.com/apex/log/handlers/memory"...
dep: Analyzing "github.com/cactus/go-statsd-client/statsd"...
dep: Analyzing "github.com/go-kit/kit/log/deprecated_levels"...
dep: Analyzing "github.com/streadway/handy/breaker"...
dep: Analyzing "github.com/go-kit/kit/sd/consul"...
dep: Analyzing "github.com/sony/gobreaker"...
dep: Analyzing "github.com/go-kit/kit/examples/shipping/inmem"...
dep: Analyzing "github.com/uber/bark"...
dep: Analyzing "github.com/apex/log/handlers/json"...
dep: Analyzing "github.com/gorilla/mux"...
dep: Analyzing "github.com/gorilla/context"...
  Locking in master (1ea2538) for transitive dep github.com/gorilla/context
dep: Analyzing "google.golang.org/grpc/metadata"...
dep: Analyzing "github.com/apex/log/handlers/logfmt"...
dep: Analyzing "github.com/dgrijalva/jwt-go"...
dep: Analyzing "github.com/prometheus/client_golang/prometheus"...
dep: Analyzing "go.uber.org/zap/buffer"...
dep: Analyzing "github.com/afex/hystrix-go/hystrix"...
dep: Analyzing "github.com/go-kit/kit/examples/shipping/location"...
dep: Analyzing "github.com/go-kit/kit/metrics/generic"...
dep: Analyzing "github.com/go-kit/kit/metrics/prometheus"...
dep: Analyzing "github.com/opentracing/opentracing-go/ext"...
dep: Analyzing "go.uber.org/zap/zapcore"...
dep: Analyzing "github.com/aphistic/golf"...
dep: Analyzing "github.com/go-kit/kit/sd/cache"...
dep: Analyzing "github.com/go-kit/kit/transport/http"...
dep: Analyzing "github.com/mattn/go-isatty"...
dep: Analyzing "github.com/aws/aws-sdk-go/aws/session"...
dep: Analyzing "go.uber.org/zap/zaptest"...
dep: Analyzing "github.com/apex/log/handlers/multi"...
dep: Analyzing "github.com/go-kit/kit/metrics"...
dep: Analyzing "github.com/kr/logfmt"...
dep: Analyzing "github.com/mattn/go-colorable"...
dep: Analyzing "golang.org/x/net/context/ctxhttp"...
dep: Analyzing "github.com/apex/log/handlers/level"...
dep: Analyzing "github.com/go-kit/kit/examples/addsvc/client/grpc"...
dep: Analyzing "github.com/go-kit/kit/log"...
dep: Analyzing "github.com/go-kit/kit/transport/grpc/_grpc_test"...
dep: Analyzing "golang.org/x/sys/windows/svc/debug"...
dep: Analyzing "sourcegraph.com/sourcegraph/appdash"...
dep: Analyzing "github.com/go-kit/kit/endpoint"...
dep: Analyzing "github.com/go-kit/kit/metrics/internal/ratemap"...
dep: Analyzing "github.com/openzipkin/zipkin-go-opentracing"...
dep: Analyzing "golang.org/x/sys/plan9"...
dep: Analyzing "google.golang.org/grpc"...
dep: Analyzing "github.com/apache/thrift/lib/go/thrift"...
dep: Analyzing "github.com/go-kit/kit/circuitbreaker"...
dep: Analyzing "github.com/go-logfmt/logfmt"...
Using network for remaining projects...
dep: Solving...
Root project is "github.com/uber-go/zap"
 146 transitively valid internal packages
 135 external packages imported from 53 projects
(0)   ✓ select (root)
(1)     ? attempt github.com/Sirupsen/logrus with 2 pkgs; at least 1 versions to try
(1)         try github.com/Sirupsen/logrus@v0.8.7
(1)     ✓ select github.com/Sirupsen/logrus@v0.8.7 w/2 pkgs
(2)     ? attempt github.com/aws/aws-sdk-go with 3 pkgs; at least 1 versions to try
(2)         try github.com/aws/aws-sdk-go@master
(2)     ✓ select github.com/aws/aws-sdk-go@master w/19 pkgs
(3)     ? attempt github.com/apache/thrift with 1 pkgs; at least 1 versions to try
(3)         try github.com/apache/thrift@cada37008ce6e609fe6312596d3ced760e5cd60c
(3)     ✓ select github.com/apache/thrift@cada37008ce6e609fe6312596d3ced760e5cd60c w/1 pkgs
(4)     ? attempt github.com/cactus/go-statsd-client with 1 pkgs; at least 1 versions to try
(4)         try github.com/cactus/go-statsd-client@dc93b8587d799a204e96175505fff9678a8ec3e1
(4)     ✓ select github.com/cactus/go-statsd-client@dc93b8587d799a204e96175505fff9678a8ec3e1 w/1 pkgs
(5)     ? attempt github.com/go-ini/ini with 1 pkgs; at least 1 versions to try
(5)         try github.com/go-ini/ini@master
(5)     ✓ select github.com/go-ini/ini@master w/1 pkgs
(6)     ? attempt github.com/coreos/etcd with 1 pkgs; at least 1 versions to try
(6)         try github.com/coreos/etcd@master
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x114d608]

goroutine 1 [running]:
github.com/golang/dep/internal/gps/pkgtree.wmToReach.func3(0xc42044a1c0, 0x1, 0x1, 0xc42027b9a1, 0x4b)
        /Users/aiden/src/go/src/github.com/golang/dep/internal/gps/pkgtree/pkgtree.go:632 +0x78
github.com/golang/dep/internal/gps/pkgtree.wmToReach.func4(0xc42027b9a1, 0x4b, 0xc42044a1c0, 0x1, 0x1, 0xc42044a101)
        /Users/aiden/src/go/src/github.com/golang/dep/internal/gps/pkgtree/pkgtree.go:771 +0x462
github.com/golang/dep/internal/gps/pkgtree.wmToReach.func4(0xc4207f8f30, 0x21, 0xc42044a1c0, 0x1, 0x1, 0x0)
        /Users/aiden/src/go/src/github.com/golang/dep/internal/gps/pkgtree/pkgtree.go:728 +0xd08
github.com/golang/dep/internal/gps/pkgtree.wmToReach(0xc4207cbd20, 0xc4207cbd01, 0xc4207cbd10, 0xc4208278d8)
        /Users/aiden/src/go/src/github.com/golang/dep/internal/gps/pkgtree/pkgtree.go:810 +0xd1c
github.com/golang/dep/internal/gps/pkgtree.PackageTree.ToReachMap(0xc4201f93a0, 0x16, 0xc420994840, 0x10001, 0xc4209871d0, 0x167f520, 0xc4202f0de0)
        /Users/aiden/src/go/src/github.com/golang/dep/internal/gps/pkgtree/pkgtree.go:501 +0x2c0
github.com/golang/dep/internal/gps.(*solver).getImportsAndConstraintsOf(0xc42001efc0, 0xc4201f93a0, 0x16, 0x0, 0x0, 0x167f520, 0xc4202f0de0, 0xc4203107f0, 0x1, 0x1, ...)
        /Users/aiden/src/go/src/github.com/golang/dep/internal/gps/solver.go:537 +0x1f7
github.com/golang/dep/internal/gps.(*solver).check(0xc42001efc0, 0xc4201f93a0, 0x16, 0x0, 0x0, 0x167f520, 0xc4202f0de0, 0xc4203107f0, 0x1, 0x1, ...)
        /Users/aiden/src/go/src/github.com/golang/dep/internal/gps/satisfy.go:43 +0x1f0
github.com/golang/dep/internal/gps.(*solver).findValidVersion(0xc42001efc0, 0xc420253900, 0xc4203107f0, 0x1, 0x1, 0x0, 0xc4203107f0)
        /Users/aiden/src/go/src/github.com/golang/dep/internal/gps/solver.go:807 +0x2d5
github.com/golang/dep/internal/gps.(*solver).createVersionQueue(0xc42001efc0, 0xc4201f93a0, 0x16, 0x0, 0x0, 0xc4203107f0, 0x1, 0x1, 0x0, 0x0, ...)
        /Users/aiden/src/go/src/github.com/golang/dep/internal/gps/solver.go:780 +0xafc
github.com/golang/dep/internal/gps.(*solver).solve(0xc42001efc0, 0x0, 0x0, 0x1e)
        /Users/aiden/src/go/src/github.com/golang/dep/internal/gps/solver.go:397 +0x471
github.com/golang/dep/internal/gps.(*solver).Solve(0xc42001efc0, 0x2e, 0x167b220, 0x16c8dc8, 0xc42001c09c)
        /Users/aiden/src/go/src/github.com/golang/dep/internal/gps/solver.go:348 +0xab
main.(*initCommand).Run(0xc420153732, 0xc420137840, 0xc420010320, 0x0, 0x0, 0x0, 0x0)
        /Users/aiden/src/go/src/github.com/golang/dep/cmd/dep/init.go:182 +0xf17
main.(*Config).Run(0xc42001af60, 0xc42001af60)
        /Users/aiden/src/go/src/github.com/golang/dep/cmd/dep/main.go:159 +0x8b3
main.main()
        /Users/aiden/src/go/src/github.com/golang/dep/cmd/dep/main.go:44 +0x253

Diving into variables with delve:

> github.com/golang/dep/internal/gps/pkgtree.wmToReach.func3() /Users/aiden/src/go/src/github.com/golang/dep/internal/gps/pkgtree/pkgtree.go:629 (hits goroutine(1):1 total:1) (PC: 0x114fd04)
   624:         poisonBlack := func(path []string, from string) {
   625:                 // Because the outer dfe loop ensures we never directly re-visit a pkg
   626:                 // that was already completed (black), we don't have to defend against
   627:                 // an empty path here.
   628:
=> 629:                 fromErr := errmap[from]
   630:                 err := &ProblemImportError{
   631:                         Err:   fromErr.Err,
   632:                         Cause: make([]string, 0, len(path)+len(fromErr.Cause)+1),
   633:                 }
   634:                 err.Cause = append(err.Cause, path...)
(dlv) p path
[]string len: 1, cap: 1, [
        "github.com/coreos/etcd/etcdserver/auth",
]
(dlv) p from
"github.com/coreos/etcd/Godeps/_workspace/src/github.com/coreos/p...+11 more"
(dlv) locals
poison = github.com/golang/dep/internal/gps/pkgtree.wmToReach.func1
fromErr = (*github.com/golang/dep/internal/gps/pkgtree.ProblemImportError)(0x1011acc)
errmap = map[string]*github.com/golang/dep/internal/gps/pkgtree.ProblemImportError [...]
err = (*github.com/golang/dep/internal/gps/pkgtree.ProblemImportError)(0xc420607b40)
(dlv) p errmap
map[string]*github.com/golang/dep/internal/gps/pkgtree.ProblemImportError [
        "github.com/coreos/etcd/snap/snappb": *{
                ImportPath: "github.com/coreos/etcd/snap/snappb",
                Cause: []string len: 1, cap: 1, [
                        "github.com/coreos/etcd/Godeps/_workspace/src/github.com/gogo/pro...+11 more",
                ],
                Err: error(*errors.errorString) ...,},
        "github.com/coreos/etcd/hack/insta-discovery": *{
                ImportPath: "github.com/coreos/etcd/hack/insta-discovery",
                Cause: []string len: 0, cap: 0, [],
                Err: error(*go/build.NoGoError) ...,},
        "github.com/coreos/etcd/hack/tls-setup/config": *{
                ImportPath: "github.com/coreos/etcd/hack/tls-setup/config",
                Cause: []string len: 0, cap: 0, [],
                Err: error(*go/build.NoGoError) ...,},
        "github.com/coreos/etcd/hack": *{
                ImportPath: "github.com/coreos/etcd/hack",
                Cause: []string len: 0, cap: 0, [],
                Err: error(*go/build.NoGoError) ...,},
        "github.com/coreos/etcd/version": *{
                ImportPath: "github.com/coreos/etcd/version",
                Cause: []string len: 2, cap: 2, [
                        "github.com/coreos/etcd/pkg/fileutil",
                        "github.com/coreos/etcd/Godeps/_workspace/src/github.com/coreos/p...+11 more",
                ],
                Err: error(*errors.errorString) ...,},
        "github.com/coreos/etcd/pkg/fileutil": *{
                ImportPath: "github.com/coreos/etcd/pkg/fileutil",
                Cause: []string len: 1, cap: 1, [
                        "github.com/coreos/etcd/Godeps/_workspace/src/github.com/coreos/p...+11 more",
                ],
                Err: error(*errors.errorString) ...,},
]

basically, fromErr is nil and the comment above suggests that should never be the case.

It would be pretty easy to add a comma-ok and check for that, but I'm unfamiliar with this part of the codebase and don't want to band-aid if this is indicative of a larger issue. Looks like the code was originally added in 31795085c1afcd25d3c87e140f9d60b19e7684e7 but later moved.

sdboyer commented 7 years ago

Yeah I've had this backburnered for a little while - it's the same panic as #607 and #357. As far as I've surmised from previous passes, the actual, data-level problem is that the depth-first traversal logic in wmToReach() assumes that there are no "internal" import statements pointing to packages that do not exist.

One user-visible way that can arise is if a dependency's main is in the required list in Gopkg.toml. There are other ways we can get there too, though, as those conditions can't occur on dep init. Either way, the solution probably ends up being the same.

sdboyer commented 7 years ago

(not that i've decided on exactly what that solution should be just yet 😛 )

ascandella commented 7 years ago

OK, we should probably just close this as a duplicate then, right? Or leave this open since I added the dlv output?

sdboyer commented 7 years ago

I'm fine to leave it open - the dlv output is helpful, but we also need to be cognizant of the different input circumstances that might lead to it occurring. as i'm not immediately clear on how a dep init could reach this bug, it seems like something new here 😄

sdboyer commented 7 years ago

Err whoops, not #357, #351

sdboyer commented 7 years ago

closing this, as it's band-aid-ed now and #351 is enough of a marker issue for the underlying problem that remains