go mod update dependencies and leave local
The error from go get -u
was a bug in the go
command, fixed in the upcoming Go 1.16 release. See https://golang.org/issue/32567 for detail.
(That said, ideally you should be hosting the modules in version control and using GOPRIVATE=mycompany.com
instead of slotting things in locally via replace
directives.)
microo8
about_me: race: programmer interests: - machine learning - parallel programming - web components - databases programming_languages: - go - python - html/js - c/c++ motto: less is exponentially more
Updated on June 06, 2022Comments
-
microo8 almost 2 years
I have a package that uses some local packages
module mycompany.com/clientname/server go 1.14 require ( github.com/lib/pq v1.7.0 github.com/99designs/gqlgen v0.11.3 github.com/vektah/gqlparser/v2 v2.0.1 golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d mycompany.com/clientname/models v0.0.0-00010101000000-000000000000 mycompany.com/common/utils v0.0.0-00010101000000-000000000000 ) replace mycompany.com/common/utils => ../../common/utils replace mycompany.com/clientname/models => ../models
the
mycompany.com
domain doesn't serve the package, it is just a fictional path (and I use it in my gopath~/go/src/mycompany.com/...
)the problem is that when I run
go get -u all
, I want the 'valid' packages to be updated (like thegithub.com/lib/pq
orgithub.com/99designs/gqlgen
), but to leave the local (fictional) packages as they are.but
go get -u all
just prints out the new versions, then prints the errors on the local packages and then doesn't changego.mod
.go: google.golang.org/grpc upgrade => v1.30.0 go: go.opencensus.io upgrade => v0.22.4 go: github.com/mattn/go-runewidth upgrade => v0.0.9 go: github.com/gogs/chardet upgrade => v0.0.0-20191104214054-4b6791f73a28 go: golang.org/x/text upgrade => v0.3.3 go: github.com/mitchellh/mapstructure upgrade => v1.3.2 go get all: unrecognized import path "mycompany.com/clientname/models": reading https://mycompany.com/clientname/models?go-get=1: 404 Not Found go get all: unrecognized import path "mycompany.com/common/utils": reading https://mycompany.com/common/utils?go-get=1: 404 Not Found