Google-cloud-go: unrecognized import path "cloud.google.com/go/datastore"

Created on 21 Aug 2019  路  2Comments  路  Source: googleapis/google-cloud-go

hi
i use go mod build grpc server锛宐ecause china's lovely firewall, I can't get the google package.
so i use mod replace 锛宧ere is my mod file

module secret/secret/secret

go 1.12

require (
    github.com/gomodule/redigo v2.0.0+incompatible
    github.com/jhump/protoreflect v1.5.0
)

replace (
    cloud.google.com/go => github.com/googleapis/google-cloud-go v0.44.3
    golang.org/x/crypto => github.com/golang/crypto v0.0.0-20190701094942-4def268fd1a4
    golang.org/x/exp => github.com/golang/exp v0.0.0-20190731235908-ec7cb31e5a56
    golang.org/x/image => github.com/golang/image v0.0.0-20190802002840-cff245a6509b
    golang.org/x/lint => github.com/golang/lint v0.0.0-20190409202823-959b441ac422
    golang.org/x/mobile => github.com/golang/mobile v0.0.0-20190814143026-e8b3e6111d02
    golang.org/x/mod => github.com/golang/mod v0.1.0
    golang.org/x/net => github.com/golang/net v0.0.0-20190813141303-74dc4d7220e7
    golang.org/x/oauth2 => github.com/golang/oauth2 v0.0.0-20190604053449-0f29369cfe45
    golang.org/x/sync => github.com/golang/sync v0.0.0-20190423024810-112230192c58
    golang.org/x/sys => github.com/golang/sys v0.0.0-20190813064441-fde4db37ae7a
    golang.org/x/text => github.com/golang/text v0.3.2
    golang.org/x/time => github.com/golang/time v0.0.0-20190308202827-9d24e82272b4
    golang.org/x/tools => github.com/golang/tools v0.0.0-20190816200558-6889da9d5479
    golang.org/x/xerrors => github.com/golang/xerrors v0.0.0-20190717185122-a985d3407aa7
    google.golang.org/api => github.com/googleapis/google-api-go-client v0.8.0
    google.golang.org/appengine => github.com/golang/appengine v1.6.1
    google.golang.org/genproto => github.com/google/go-genproto v0.0.0-20190817000702-55e96fffbd48
    google.golang.org/grpc => github.com/grpc/grpc-go v1.23.0
)

console output

go: cloud.google.com/go/[email protected]: unrecognized import path "cloud.google.com/go/datastore" (https fetch: Get https://cloud.google.com/go/datastore?go-get=1: dial tcp 172.217.160.78:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)
go: error loading module requirements
datastore question

Most helpful comment

Hello!

Two things:

  • You need the require statement as well as the replace statement.
  • Datastore is its own module. You'll need a similar require and replace statement for that.

All 2 comments

Hello!

Two things:

  • You need the require statement as well as the replace statement.
  • Datastore is its own module. You'll need a similar require and replace statement for that.

@jadekler
Thank you very much. The problem has been solved.

cloud.google.com/go/datastore => github.com/googleapis/google-cloud-go/datastore v1.0.0
Was this page helpful?
0 / 5 - 0 ratings