Integrating with google cloud datastore

Hello. I have a go module where I am trying to integrate with google cloud store. I am using go v1.14. When I do go get on the cloud datastore, it gives the following error.

go: cloud.google.com/go/datastore upgrade => v1.1.0
go get: cloud.google.com/go/datastore@v1.1.0 requires
	google.golang.org/api@v0.17.0 requires
	cloud.google.com/go@v0.38.0 requires
	golang.org/x/lint@v0.0.0-20190301231843-5614ed5bae6f/go.mod: verifying module: golang.org/x/lint@v0.0.0-20190301231843-5614ed5bae6f/go.mod: malformed record data

Below are the contents of my go.mod file

module <MyNamespace>.com/<moduleName>

go 1.14

require (
	github.com/stretchr/testify v1.5.1
)
 

I don’t really understand the error. Could someone please help me out in understanding it?

I can’t reproduce your problem. Give an new module

module de.lhorn/forum

go 1.13

require cloud.google.com/go/datastore v1.1.0

require github.com/stretchr/testify v1.5.1

and a main.go like

package main

import (
        _ "cloud.google.com/go/datastore"
        "fmt"
        _ "github.com/stretchr/testify"
)

func main() {
        fmt.Println("vim-go")
}

running go build . works as expected. It downloads the required modules and their dependencies and builds the executable.

Since you are using modules, try to run go build . instead of go get.

Thanks @lutzhorn for your response.

I just found the problem. The update was conflicting with some local cache that was downloaded. After clearing the cache, I was able to run it with go get.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.