如何使用Go模块通过提交哈希或分支拉取依赖项?

I'm trying to upgrade my project to use Go modules for dependency management. I recognize this a new/experimental feature. I'm getting an error: cannot find module providing package.

My go.mod currently reads:

require (
    github.com/bugsnag/bugsnag-go v1.5.1
    github.com/bwmarrin/discordgo v0.19.0
    github.com/jonas747/dshardmanager v0.0.0-20180911185241-9e4282faed43
)

My Dockerfile:

FROM golang:1.12-alpine
RUN mkdir /app
WORKDIR /app
ADD src/ /app

ENV CGO_ENABLED=0

# Building requires git because we're pulling a dependency by commit hash
RUN apk add --no-cache --update git \
    && go build ./... \
    && apk del git

CMD ["/app/main"]

When building, it fails with:

cannot load github.com/bugsnag/panicwrap: cannot find module providing package github.com/bugsnag/panicwrap

When I look at https://github.com/bugsnag/bugsnag-go I don't see a go.mod file. Is this error indicating that this dependency doesn't support modules?

You're doing something wrong, because it works. It does not need a go.mod in order to work with go.mod-based applications:

nrxr at lise in ~/code/src/github.com/nrxr/stack
$ go mod init
go: creating new go.mod: module github.com/nrxr/stack

nrxr at lise in ~/code/src/github.com/nrxr/stack
$ go get github.com/bugsnag/bugsnag-go
go: finding github.com/bugsnag/bugsnag-go v1.5.1
go: downloading github.com/bugsnag/bugsnag-go v1.5.1
go: extracting github.com/bugsnag/bugsnag-go v1.5.1
go: finding github.com/bugsnag/panicwrap v1.2.0
go: downloading github.com/bugsnag/panicwrap v1.2.0
go: finding github.com/gofrs/uuid v3.2.0+incompatible
go: downloading github.com/gofrs/uuid v3.2.0+incompatible
go: extracting github.com/bugsnag/panicwrap v1.2.0
go: extracting github.com/gofrs/uuid v3.2.0+incompatible
go: finding github.com/kardianos/osext latest
go: downloading github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
go: extracting github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0

nrxr at lise in ~/code/src/github.com/nrxr/stack
$ cat go.mod
module github.com/nrxr/stack

go 1.12

require (
        github.com/bugsnag/bugsnag-go v1.5.1 // indirect
        github.com/bugsnag/panicwrap v1.2.0 // indirect
        github.com/gofrs/uuid v3.2.0+incompatible // indirect
        github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect
)

Maybe try again? Try with what I just used here.