go-modules

How do I use Go with Bitbucket private repositories?

三世轮回 提交于 2020-08-22 06:38:43
问题 We are using private Bitbucket repositories to manage our Go libraries. By using the insteadOf config for git as described e.g. in this Stackoverflow answer, we had a working build up to Go version 1.12. Versions 1.13 and 1.14 do not work any more. We are seeing errors like this: $ go vet ./... go: downloading bitbucket.org/travelloapp/golibs v1.0.42 usercache/usercache.go:6:2: bitbucket.org/travelloapp/golibs@v1.0.42: verifying module: bitbucket.org/travelloapp/golibs@v1.0.42: reading https:

How do I use Go with Bitbucket private repositories?

孤街浪徒 提交于 2020-08-22 06:36:33
问题 We are using private Bitbucket repositories to manage our Go libraries. By using the insteadOf config for git as described e.g. in this Stackoverflow answer, we had a working build up to Go version 1.12. Versions 1.13 and 1.14 do not work any more. We are seeing errors like this: $ go vet ./... go: downloading bitbucket.org/travelloapp/golibs v1.0.42 usercache/usercache.go:6:2: bitbucket.org/travelloapp/golibs@v1.0.42: verifying module: bitbucket.org/travelloapp/golibs@v1.0.42: reading https:

How to declare golang dependency versions best in go.mod?

好久不见. 提交于 2020-08-10 04:49:08
问题 The classical way to declare a dependency's version in go mod is via require ( k8s.io/api v0.17.4 k8s.io/apimachinery v0.17.4 k8s.io/cli-runtime v0.17.0 k8s.io/client-go v0.17.4 ) In the past (go <= 1.12 ?) this has been resolved to timestamp versions, but recently the versions are kept untouched. However, I've also seen this technique to pin versions: require ( k8s.io/api v0.17.4 k8s.io/apimachinery v0.17.4 k8s.io/client-go v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible k8s.io/code

Go modules pulls old version of a package

不打扰是莪最后的温柔 提交于 2020-08-08 03:38:06
问题 I'm trying to add a new package to my project with go modules. This package is using github.com/docker/docker/client and works fine outside of the project. When I run go mod vendor it pulls docker client package of version v1.13.1 which does not have some of the methods I am using in my code, but in go modules it is tagged as latest. How do I make go mod use the truly latest version of a package? 回答1: Go Wiki: Modules: When needed, more specific versions of dependencies can be chosen with

Relative import in Go for protobuf , cannot find module path

扶醉桌前 提交于 2020-07-31 06:05:36
问题 I'm trying to write a service in go with gRPC, and when i import the protobuff file , getting an error. i tried removing all the modules in my go path and reinitialising the go modules build _/Users/tibinlukose/cart-service/pb: cannot find module for path _/Users/tibinlukose/cart-service/pb Code package main import ( pbcart "../pb/" "log" "fmt" "google.golang.org/grpc" "net" ) var ( port = 1000; ) type CartServiceServer struct { } func main() { log.SetFlags(log.LstdFlags | log.Lshortfile) fmt

go get on forked github repo got “unexpected module path” error

假如想象 提交于 2020-06-22 19:45:12
问题 I'm currently working something on AWS Cloudformation which using this repo https://github.com/awslabs/goformation. Because I did some customise so I made a fork https://github.com/vrealzhou/goformation. Now in my other project (using go module) I'm trying to using go get github.com/vrealzhou/goformation@v2.3.1 and I've got this error: go: github.com/vrealzhou/goformation@v0.0.0-20190513073615-ff3b65adb278: parsing go.mod: unexpected module path "github.com/awslabs/goformation" go: error

go get on forked github repo got “unexpected module path” error

时光怂恿深爱的人放手 提交于 2020-06-22 19:40:33
问题 I'm currently working something on AWS Cloudformation which using this repo https://github.com/awslabs/goformation. Because I did some customise so I made a fork https://github.com/vrealzhou/goformation. Now in my other project (using go module) I'm trying to using go get github.com/vrealzhou/goformation@v2.3.1 and I've got this error: go: github.com/vrealzhou/goformation@v0.0.0-20190513073615-ff3b65adb278: parsing go.mod: unexpected module path "github.com/awslabs/goformation" go: error

How to override a dependency in go modules?

ぃ、小莉子 提交于 2020-06-13 08:50:10
问题 In dep you have the option to override a dependency and have it point to a different repo for example in the following https://github.com/kubermatic/glog-logrus library one needs to add the following lines to the Gopkg.toml file: [[override]] name = "github.com/golang/glog" source = "github.com/kubermatic/glog-logrus" Then in the codebase you import "github.com/golang/glog . However, in go modules I don't see such an option? which leads me to think the only solution is to change the import to