Description
What version of Go are you using (go version
)?
$ go version go version go1.11.4 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GOARCH="amd64" GOBIN="" GOCACHE="/Users/tsheaff/Library/Caches/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/tsheaff/go" GOPROXY="" GORACE="" GOROOT="/usr/local/Cellar/go/1.11.4/libexec" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.11.4/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/tsheaff/Code/private/calm/titan/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/w4/6yt_ksl50ss8_svs807ztbkr0000gn/T/go-build858324860=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
I used go get
to add a dependency that I'd like to use in development (in this case it is realize). This is conceptually similar to the distinction between dependencies
and devDependencies
in npm. This would apply to build tools, hot reloaders, linters, or any other package that I don't want compiled up into the application executable, but for use from the command line before the application starts up (or even before it builds). Here's my terminal session demonstrating the issue:
$ git --no-pager diff go.mod
$ go get -u github.com/oxequa/realize
go: finding github.com/oxequa/interact latest
go: finding github.com/go-siris/siris/core/errors latest
go: finding github.com/go-siris/siris/core latest
go: finding github.com/labstack/echo/middleware latest
go: finding gopkg.in/urfave/cli.v2 latest
go: finding github.com/valyala/fasttemplate latest
go: finding github.com/labstack/gommon/bytes latest
go: finding github.com/labstack/gommon/color latest
go: finding github.com/labstack/gommon/random latest
go: finding github.com/labstack/gommon/log latest
$ git --no-pager diff go.mod
diff --git a/go.mod b/go.mod
index fc9704b..b3e43a2 100644
--- a/go.mod
+++ b/go.mod
@@ -3,21 +3,34 @@ module github.com/calm/titan
require (
github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 // indirect
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
+ github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
+ github.com/fatih/color v1.7.0 // indirect
+ github.com/fsnotify/fsnotify v1.4.7 // indirect
github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7 // indirect
github.com/gin-gonic/contrib v0.0.0-20181101072842-54170a7b0b4b
github.com/gin-gonic/gin v1.3.0
+ github.com/go-siris/siris v7.4.0+incompatible // indirect
github.com/gocql/gocql v0.0.0-20181124151448-70385f88b28b
github.com/golang/protobuf v1.2.0 // indirect
github.com/json-iterator/go v1.1.5 // indirect
github.com/kr/pretty v0.1.0 // indirect
+ github.com/labstack/echo v3.3.5+incompatible // indirect
+ github.com/labstack/gommon v0.2.8 // indirect
+ github.com/mattn/go-colorable v0.0.9 // indirect
github.com/mattn/go-isatty v0.0.4 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
+ github.com/oxequa/interact v0.0.0-20171114182912-f8fb5795b5d7 // indirect
+ github.com/oxequa/realize v2.0.2+incompatible // indirect
+ github.com/satori/go.uuid v1.2.0 // indirect
github.com/sirupsen/logrus v1.2.0
github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 // indirect
+ github.com/valyala/bytebufferpool v1.0.0 // indirect
+ github.com/valyala/fasttemplate v0.0.0-20170224212429-dcecefd839c4 // indirect
golang.org/x/net v0.0.0-20181220203305-927f97764cc3 // indirect
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 // indirect
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
gopkg.in/go-playground/validator.v8 v8.18.2 // indirect
+ gopkg.in/urfave/cli.v2 v2.0.0-20180128182452-d3ae77c26ac8 // indirect
gopkg.in/yaml.v2 v2.2.2 // indirect
)
$ which realize
realize not found
What did you expect to see?
I expected realize
to be in my PATH
, or available via ./vendor/bin/realize
or similar, and to be added to any other developer's path when they install the dependencies from a fresh repo clone. This is especially important in Docker or CI.
I also don't want go mod tiny
to get rid of this dependency (or any other mechanism that may "prune" my dependencies by reading my source and determining which dependencies are referenced in the code).
What did you see instead?
Instead, it listed the dependency and version in go.mod
and go.sum
as expected, but it's not clear (at least to me) how to reference the binary executable from the command line (e.g. CMD ["realize start"]
in my dockerfile
)
Is there a concept like npm's devDependencies
with go modules
? I'm fairly new to go, and I know go modules are new as well, so hopefully this is just a simple misunderstanding on my end, but any clarity here would be extremely helpful.