go verify module failed (how does go sumsdb work?) - go

I encountered this error on go build:
go: github.com/frankban/quicktest#v1.14.2: verifying module: github.com/frankban/quicktest#v1.14.2: Get "https://sum.golang.org/lookup/github.com/frankban/quicktest#v1.14.2": Not Found
My question is, why the frankban/quicktest is not found in sum db? as a matter of fact this is not the only package that caused this error, last time I try to compile the same project (about an hour ago), the error was on golang.org/x/xerrors.
Further more, could anyone explain (or point out some documents/articles/blogs) on how the go module system's "sums db" work. It is very frustrating if anyone encounter such error as there seems nothing you can do to fix it?
Full log:
$ go get -u
go: downloading github.com/tealeg/xlsx v1.0.5
go: downloading github.com/shabbyrobe/xmlwriter v0.0.0-20220218224045-defe0ad214f6
go: downloading github.com/frankban/quicktest v1.14.2
go: downloading golang.org/x/text v0.3.3
go: downloading github.com/google/btree v1.0.1
go: downloading github.com/kr/pretty v0.3.0
go: downloading golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
go: downloading github.com/kr/text v0.2.0
go: github.com/frankban/quicktest#v1.14.2: verifying module: github.com/frankban/quicktest#v1.14.2: Get "https://sum.golang.org/lookup/github.com/frankban/quicktest#v1.14.2": Not Found
go: github.com/google/btree#v1.0.1: verifying module: github.com/google/btree#v1.0.1: Get "https://sum.golang.org/lookup/github.com/google/btree#v1.0.1": Not Found
go: github.com/kr/pretty#v0.3.0: verifying module: github.com/kr/pretty#v0.3.0: Get "https://sum.golang.org/lookup/github.com/kr/pretty#v0.3.0": Not Found
go: github.com/kr/text#v0.2.0: verifying module: github.com/kr/text#v0.2.0: Get "https://sum.golang.org/lookup/github.com/kr/text#v0.2.0": Not Found
go: github.com/shabbyrobe/xmlwriter#v0.0.0-20220218224045-defe0ad214f6: verifying module: github.com/shabbyrobe/xmlwriter#v0.0.0-20220218224045-defe0ad214f6: Get "https://sum.golang.org/lookup/github.com/shabbyrobe/xmlwriter#v0.0.0-20220218224045-defe0ad214f6": Not Found

The sum.golang.org server needs some time to update the hash sum. Try again now. Everything works correctly for me:
$ GO111MODULE=on go get github.com/shabbyrobe/xmlwriter#v0.0.0-20220218224045-defe0ad214f6
go: downloading github.com/shabbyrobe/xmlwriter v0.0.0-20220218224045-defe0ad214f6
go: downloading golang.org/x/text v0.3.2
$ curl https://sum.golang.org/lookup/github.com/shabbyrobe/xmlwriter#v0.0.0-20220218224045-defe0ad214f6
9249991
github.com/shabbyrobe/xmlwriter v0.0.0-20220218224045-defe0ad214f6 h1:ri617veNyNwEMXywzcLmU//YIVSFdJvdk39lNsFB/Ro=
github.com/shabbyrobe/xmlwriter v0.0.0-20220218224045-defe0ad214f6/go.mod h1:tKYSeHyJGYz7eoZMlzrRDQSfdYPYt0UduMr8b97Mmaw=
go.sum database tree
9690070
OufFSNsOUYeDJ2VPyrxBAe7/d47lQYkE03JZL2ltaI8=
— sum.golang.org Az3grkvrWUkW3Rvnl5QL72oZpiY5ifJhab3/evZCb0hmRkEtGRE/tCMyFDXftZWFi2SF71EuHAxJMTgLd1laHabOzAE=

Related

go get command stuck on Mac

I'm trying to install some libraries in golang. But it always stuck when I run go get [package]. The error varies. One of them is like this:
➜ alif git:(master) ✗ go get "github.com/go-playground/validator/v10"
go: downloading github.com/go-playground/validator/v10 v10.11.2
go: downloading github.com/go-playground/validator v9.31.0+incompatible
go: github.com/go-playground/validator/v10#v10.11.2: read "https:/proxy.golang.org/#v/v10.11.2.zip": read tcp 192.164.0.2:58505->34.101.4.81:443: read: connection reset by peer
Sometimes it is a connection refused or timeout.
➜ alif git:(master) ✗ go get "github.com/go-playground/validator/v10"
go: downloading github.com/go-playground/validator/v10 v10.11.2
go: downloading github.com/go-playground/validator v9.31.0+incompatible
go: golang.org/x/crypto#v0.5.0: verifying go.mod: golang.org/x/crypto#v0.5.0/go.mod: Get "https://sum.golang.org/lookup/golang.org/x/crypto#v0.5.0": net/http: TLS handshake timeout
My internet work just fine. And in fact previously like 2 days ago, I have no problem downloading go dependencies.
My go version is go1.19, I tried to upgrade it to go1.20 but the problem still occurs. And I'm using macOS M1. What can I do?

Deploying Go app on Google Cloud 'missing go.sum entry'

I'm trying to deploy a simple API on Google Cloud using Go 1.19
> go version
go version go1.19.2 windows/amd64
I'm following this documentation as a template to deploy my app. But the deploy fails.
Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build xxx status: FAILURE
go: github.com/go-redis/redis/v9#v9.0.0-rc.1 requires
github.com/onsi/ginkgo#v1.16.5: missing go.sum entry; to add it:
go mod download github.com/onsi/ginkgo
Cloud build log:
Running "go build -o /layers/google.go.build/bin/main . (GOCACHE=/layers/google.go.build/gocache)"
go: github.com/go-redis/redis/v9#v9.0.0-rc.1 requires
github.com/onsi/ginkgo#v1.16.5: missing go.sum entry; to add it:
go mod download github.com/onsi/ginkgo
Done "go build -o /layers/google.go.build/bin/main . (GOCACHE=/lay..." (7.516802ms)
Failure: (ID: 721b15b4) go: github.com/go-redis/redis/v9#v9.0.0-rc.1 requires
github.com/onsi/ginkgo#v1.16.5: missing go.sum entry; to add it:
go mod download github.com/onsi/ginkgo
--------------------------------------------------------------------------------
Running "mv -f /builder/outputs/output-5577006791947779410 /builder/outputs/output"
Done "mv -f /builder/outputs/output-5577006791947779410 /builder/o..." (3.938721ms)
ERROR: failed to build: exit status 1
Running the suggested go mod download github.com/onsi/ginkgo does not solve anything.
Also tried go mod tidy as suggested in another posts but same results. Also tried with vendor folder, but nothing again.
This is my app.yaml
runtime: go116
go.mod
module notams/anac
go 1.19
require (
github.com/go-redis/redis/v9 v9.0.0-rc.1
github.com/gorilla/mux v1.8.0
github.com/joho/godotenv v1.4.0
golang.org/x/exp v0.0.0-20221019170559-20944726eadf
)
require (
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
)
go.sum
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/go-redis/redis/v9 v9.0.0-rc.1 h1:/+bS+yeUnanqAbuD3QwlejzQZ+4eqgfUtFTG4b+QnXs=
github.com/go-redis/redis/v9 v9.0.0-rc.1/go.mod h1:8et+z03j0l8N+DvsVnclzjf3Dl/pFHgRk+2Ct1qw66A=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/gomega v1.21.1 h1:OB/euWYIExnPBohllTicTHmGTrMaqJ67nIu80j0/uEM=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
golang.org/x/exp v0.0.0-20221019170559-20944726eadf h1:nFVjjKDgNY37+ZSYCJmtYf7tOlfQswHqplG2eosjOMg=
golang.org/x/exp v0.0.0-20221019170559-20944726eadf/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
EDIT 1: Already tried to change runtime: go and to runtime: go119 but those are not supported and return "invalid go runtime".
To anyone who might have this problem, I just deployed the app on Cloud Run instead of App Engine and everything runs smoothly. I was not able to deploy it on App Engine and i think that the only way to do so is adapting the code and modules to the latest runtime version available for GCP (currently Go 1.16).

Installing a Go tool from github and facing installation errors

I want to install this tool from github : https://github.com/ethicalhackingplayground/ssrf-tool
I am using the cmd : go install github.com/ethicalhackingplayground/ssrf-tool#latest
Output :
go: finding module for package github.com/projectdiscovery/gologger
go: finding module for package github.com/briandowns/spinner
go: finding module for package github.com/logrusorgru/aurora
go: found github.com/briandowns/spinner in github.com/briandowns/spinner v1.18.1
go: found github.com/logrusorgru/aurora in github.com/logrusorgru/aurora v2.0.3+incompatible
go: found github.com/projectdiscovery/gologger in github.com/projectdiscovery/gologger v1.1.4
# github.com/ethicalhackingplayground/ssrf-tool
..\..\..\go\pkg\mod\github.com\ethicalhackingplayground\ssrf-tool#v0.0.0-20200901082948-7f3cffc3c7bb\ssrftool.go:34:2: undefined: gologger.Printf
..\..\..\go\pkg\mod\github.com\ethicalhackingplayground\ssrf-tool#v0.0.0-20200901082948-7f3cffc3c7bb\ssrftool.go:35:2: undefined: gologger.Infof
..\..\..\go\pkg\mod\github.com\ethicalhackingplayground\ssrf-tool#v0.0.0-20200901082948-7f3cffc3c7bb\ssrftool.go:36:2: undefined: gologger.Infof
I am super new to golang, go installation is fine in my system because other tools from github are working fine.
If some changes are required in the code of this tool, please suggest so.
This sources created without go module support and an old version of gologger, here is a workaround:
Clone repository git clone git#github.com:ethicalhackingplayground/ssrf-tool.git
cd ssrf-tool create go.mod file with content:
module github.com/ethicalhackingplayground/ssrf-tool
go 1.17
require (
github.com/briandowns/spinner v1.18.1
github.com/logrusorgru/aurora v2.0.3+incompatible
github.com/projectdiscovery/gologger v1.0.1
)
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.7.0 // indirect
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/mattn/go-isatty v0.0.8 // indirect
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 // indirect
)
download deps go mod download
Build executable go build .
./ssrf-tool --help
Profit.
Here is the repo with the problem fixed.
go install github.com/R0X4R/ssrf-tool#latest
or
git clone https://github.com/R0X4R/ssrf-tool.git
cd ssrf-tool
go build ssrftool.go && mv ssrftool /usr/bin/

Can't install go modules

I'm trying to follow a tutorial on how to create a Go microservice but I keep getting this errors whenever I run go mod tidy.
$ go mod tidy
go: finding module for package github.com/velotiotech/watermark-service/internal
go: finding module for package github.com/lithammer/shortuuid/v3
go: finding module for package github.com/go-kit/kit/log
go: downloading github.com/go-kit/kit v0.12.0
go: downloading github.com/lithammer/shortuuid/v3 v3.0.7
go: downloading github.com/velotiotech/watermark-service v0.0.0-20200604060255-debbccd8157b
github.com/chococascante/focus-archery-api/pkg imports
github.com/go-kit/kit/log: github.com/go-kit/kit#v0.12.0: verifying module: github.com/go-kit/kit#v0.12.0: initializing sumdb.Client: reading tree note: malformed note
note:
github.com/chococascante/focus-archery-api/pkg imports
github.com/lithammer/shortuuid/v3: github.com/lithammer/shortuuid/v3#v3.0.7: verifying module: github.com/lithammer/shortuuid/v3#v3.0.7: initializing sumdb.Client: reading tree note: malformed note
note:
github.com/chococascante/focus-archery-api/pkg imports
github.com/velotiotech/watermark-service/internal: github.com/velotiotech/watermark-service#v0.0.0-20200604060255-debbccd8157b: verifying module: github.com/velotiotech/watermark-service#v0.0.0-20200604060255-debbccd8157b: initializing sumdb.Client: reading tree note: malformed note
note:
Try disable the integrity check. Or try to change sum.golang.org to proxy.golang.org.
go env -w GOSUMDB=off

replace module failed goland

I'm having a hard time replacing a module within go.
I was trying to clean the cache, go get <PackageName>, explicitly telling the compiler to change the module path etc..
replace github.com/terraform-providers/terraform-provider-aws => github.com/hashicorp/terraform-provider-aws v1.2.3
I was digging online but non of the solutions I saw helped me.
GOROOT=C:\Program Files\Go #gosetup
GOPATH=C:\Users\omer\go #gosetup
"C:\Program Files\Go\bin\go.exe" mod tidy #gosetup
go: finding module for package github.com/hashicorp/terraform-provider-aws
go: finding module for package github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource
go: finding module for package github.com/hashicorp/terraform-plugin-sdk/v2/terraform
go: finding module for package github.com/hashicorp/terraform-plugin-sdk/v2/diag
go: finding module for package golang.org/x/crypto/ssh
go: finding module for package github.com/hashicorp/go-multierror
go: finding module for package github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema
go: finding module for package github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation
go: found github.com/hashicorp/go-multierror in github.com/hashicorp/go-multierror v1.1.1
go: found github.com/hashicorp/terraform-plugin-sdk/v2/diag in github.com/hashicorp/terraform-plugin-sdk/v2 v2.8.0
go: found github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema in github.com/hashicorp/terraform-plugin-sdk/v2 v2.8.0
go: found github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation in github.com/hashicorp/terraform-plugin-sdk/v2 v2.8.0
go: found github.com/ravendb/ravendb-go-client in github.com/ravendb/ravendb-go-client v0.0.0-00010101000000-000000000000
go: found github.com/ravendb/ravendb-go-client/serverwide/operations in github.com/ravendb/ravendb-go-client v0.0.0-00010101000000-000000000000
go: found github.com/ravendb/terraform-provider-ravendb/utils in github.com/ravendb/terraform-provider-ravendb v0.0.0-00010101000000-000000000000
go: found golang.org/x/crypto/ssh in golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
go: found github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource in github.com/hashicorp/terraform-plugin-sdk/v2 v2.8.0
go: found github.com/hashicorp/terraform-plugin-sdk/v2/terraform in github.com/hashicorp/terraform-plugin-sdk/v2 v2.8.0
go: found github.com/hashicorp/terraform-provider-aws in github.com/hashicorp/terraform-provider-aws v1.60.0
go: terraform-provider-ravendb/ravendb tested by
terraform-provider-ravendb/ravendb.test imports
github.com/hashicorp/terraform-provider-aws: github.com/hashicorp/terraform-provider-aws#v1.60.0: parsing go.mod:
module declares its path as: github.com/terraform-providers/terraform-provider-aws
but was required as: github.com/hashicorp/terraform-provider-aws

Resources