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
Related
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=
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/
A Go language tutorial uses the "quote" package to get familiar quotes. When I give the command "go get -v rsc.io/quote", I get the message
code in directory.../github/hello/src/rsc.io/quote/v3 expects import "rsc.io/quote"
So I went there and looked at the code. It has an import statement:
import "rsc.io/quote/v3"
So I thought maybe I had the wrong version of quote. Accordingly, I tried "go get -v rsc.io/quite/v3" THis produces the message:
code in directory .../rsc.io/quote/v3 expects import "rsc.io/quote."
This seems circular: asking without a version number produces a requirement for a versioned package, but trying to get a versioned package produces a requirement without a version number.
If you continue the tutorial to the end you will see that the addition of a go module, and the subsequent initialisation, will resolve your issue. The .mod file will pull in the required dependencies.
Can you try
go get -v rsc.io/quote
get "rsc.io/quote": found meta tag get.metaImport{Prefix:"rsc.io/quote", VCS:"git", RepoRoot:"https://github.com/rsc/quote"} at //rsc.io/quote?go-get=1
rsc.io/quote (download)
get "rsc.io/sampler": found meta tag get.metaImport{Prefix:"rsc.io/sampler", VCS:"git", RepoRoot:"https://github.com/rsc/sampler"} at //rsc.io/sampler?go-get=1
rsc.io/sampler (download)
github/gospace/src/rsc.io/quote/quote.go:8:8: code in directory /Users/james/github/gospace/src/rsc.io/quote/v3 expects import "rsc.io/quote"
cat $GOPATH/src/rsc.io/quote/v3/go.mod
module rsc.io/quote/v3
require rsc.io/sampler v1.3.0
~> cat $GOPATH/src/rsc.io/quote/v3/go.sum
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c h1:qgOY6WgZOaTkIIMiVjBQcw93ERBE4m30iBm00nkL0i8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
rsc.io/sampler v1.99.99 h1:7i08f/p5TBU5joCPW3GjWG1ZFCmr28ybGqlXtelhEK8=
rsc.io/sampler v1.99.99/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
More about go get vs go install. What is the difference between go get and go install?
Can you please check your GO env path settings:
export GOPATH=$HOME/github/<your_workspace_name>
export GOBIN=$GOPATH/bin
export GOROOT=/usr/local/go
export PATH=$PATH:/usr/local/bin:/usr/local/go/bin:$GOPATH/bin
Here is a good source for setting up workspace:
https://golang.org/doc/gopath_code.html
As #MartinBennett mentioned, it's already mentioned in the tutorial but may be not so clear.
Once you add import "rsc.io/quote" in your hello.go file, you will need to run these commands in your terminal:
1-
go mod init hello
2-
go run hello.go
I am trying to add reflection to my working Go-based gRPC. I am getting an error when I try to fetch the reflection package:
$ GO111MODULE=on go get google.golang.org/grpc/reflection
go: github.com/google/go-github#v0.0.0-20190119011113-56cb1dd99043: go.mod has post-v0 module path "github.com/google/go-github/v21" at revision 56cb1dd99043
go: error loading module requirements
I can't find any reference to "go-github/v21" anywhere in my source, or in any of the packages in my GOPATH.
I also can't figure out what this error message means.
I am using Go version go1.11.5.
Thanks.
I am working on an App Engine app and am coming across this error running goapp serve:
Failed parsing input: parser: bad import "syscall" in vendor/golang.org/x/net/icmp/message.go
Which is apparently from Glide importing the entire golang.org/x/net package when I only wanted golang.org/x/net/context.
The import in my glide.yaml was:
- package: golang.org/x/net
subpackages:
- context
And the glide.lock file says
- name: golang.org/x/net
version: 07b51741c1d6423d4a6abab1c49940ec09cb1aaf
subpackages:
- context
How would I keep net/icmp out of my build in goapp serve?
I often had extra imports when using glide (a bit like in issue 101)
Just for testing, try re-populate your vendor folder using govendor
govendor list
govendor fetch +m
In my experience, the resulting list of dependencies is cleaner.