I'm having problem while vendoring my go-project. Tried with both glide and go-dep - getting same problem.
$ go get -u go.opencensus.io gives the following error:
package go.opencensus.io/opencensus-go: unrecognized import path "go.opencensus.io/opencensus-go" (https fetch: Get https://go.opencensus.io/opencensus-go?go-get=1: dial tcp <some-ip>: i/o timeout)
Github link of this package - https://github.com/census-instrumentation/opencensus-go
Tried setting a proxy to shell
export http_proxy=http://104.248.231.49:8080/
export https_proxy=http://104.248.231.49:8080/
And then it worked.
Related
I have a go program which imports a custom module hosted internally
import (
"fmt"
"log"
...
"gitlab.org.myteam.com/teamrepo/project1"
)
When I do go build I get following errors:
main.go:15:2: no required module provides package gitlab.org.myteam.com/teamrepo/project1; to add it:
go get gitlab.org.myteam.com/teamrepo/project1
As directed when I do go get I get following errors:
go: downloading gitlab.org.myteam.com/teamrepo/project1 v1.0.1
go: gitlab.org.myteam.com/teamrepo/project1#v1.0.1: verifying module: gitlab.org.myteam.com/teamrepo/project1#v1.0.1: reading https://sum.golang.org/lookup/gitlab.org.myteam.com/teamrepo/project1#v1.0.1: 404 Not Found
server response: not found: gitlab.org.myteam.com/teamrepo/project1#v1.0.1: unrecognized import path "gitlab.org.myteam.com/teamrepo/project1": https fetch: Get "https://gitlab.org.myteam.com/teamrepo/project1?go-get=1": dial tcp 10.xx.xx.xxx:443: connect: connection refused
I am not sure what I am doing wrong here. git clone on this repository works fine, so it is accessible.
Further, two things that I find confusing in the errors are:
Why go is trying to read the path reading https://sum.golang.org/lookup/gitlab.org.myteam.com/teamrepo/project1#v1.0.1: 404 Not Found
And, how it decided to fetch version v1.0.1 as I haven’t explicitly specified this version anywhere.
go version go1.19.4 darwin/amd64
Im using golangci-lint and getting the following error in CI, any idea what could be the reason? and how can I avoid this.
Our GitHub repo is already have all the vendor packages so it shouldn't install it in first place.
golangci-lint run --config golangci.yml
level=error msg="Running error: context loading failed: failed to load packages: failed to load with go/packages: err: exit
status 1: stderr: go: github.avt.corp/ding/logger-ut#v1.1.0:
unrecognized import path "github.avt.corp/ding/logger-ut" (https
fetch: Get https://github.avt.corp/ding/logger-ut?go-get=1: x509:
certificate signed by unknown authority)\n"
btw I was able to clone the project and run it
Use the following:
run:
modules-download-mode: vendor
or add this to the command you are runnig
--modules-download-mode vendor
So I am trying to install my Go app's dependencies on my Raspberry 3/Raspbian system with "go get" and running into the following when trying to install gRPC for Go:
[pi#raspberrypi-1 camera-service] 17:32:28 % go get google.golang.org/grpc
package google.golang.org/grpc: unrecognized import path "google.golang.org/grpc" (https fetch: Get https://google.golang.org/grpc?go-get=1: dial tcp: lookup google.golang.org on 192.168.1.1:53: read udp 192.168.1.64:33524->192.168.1.1:53: i/o timeout)
Meanwhile I am able to install other (non-google.golang.org) dependencies (for example go get github.com/asaskevich/EventBus) just fine.
To me this looks a DNS problem -- 192.168.1.1 is my router, 192.168.1.64 is my RPi. However I can resolve the address just fine:
[pi#raspberrypi-1 camera-service] 17:32:52 % host google.golang.org
google.golang.org is an alias for golang.org.
golang.org has address 216.58.209.145
golang.org has IPv6 address 2a00:1450:400f:804::2011
golang.org mail is handled by 1 aspmx.l.google.com.
golang.org mail is handled by 2 alt2.aspmx.l.google.com.
golang.org mail is handled by 2 alt1.aspmx.l.google.com.
golang.org mail is handled by 2 alt3.aspmx.l.google.com.
This is weird. Also I have installed the same packages on another system np.
My environment is
- Go 1.8.3, installed from prebuilt ARM6 binary
- export GOROOT="/usr/local/go"
- export GOPATH="/home/pi/go"
This may be because you are using the built in DNS resolver in Go, rather than delegating to the system name resolver. When you built gRPC, did you set CGO_ENABLED=1 ? You can check by setting GODEBUG=netdns=cgo when getting gRPC:
$ GODEBUG=netdns=cgo go get google.golang.org/grpc
Unrecognized import path while fetching go package gin. How do I resolve this issue
go get github.com/gin-gonic/gin
package gopkg.in/go-playground/validator.v8: unrecognized import path "gopkg.in/go-playground/validator.v8" (https fetch: Get https://gopkg.in/go-playground/validator.v8?go-get=1: dial tcp: i/o timeout)
package gopkg.in/yaml.v2: unrecognized import path "gopkg.in/yaml.v2" (https fetch: Get https://gopkg.in/yaml.v2?go-get=1: dial tcp: i/o timeout)
According to issue #51 - which has a similar error - indicates that this is a problem with your network. Try again later or use some proxy, as suggested on the GitHub page, such as:
Goproxy
Lantern
Also, make sure you can go get other packages. It might be a package only problem or a 'global' one. In this case try the proxies above
I just tried the command, and it works find.
Is your GOPATH correctly set? see the documentation for more info.
I try to use go get gopkg.in/fatih/pool.v2 to install pool according to Readme.md, but can't success:
C:\Users\xiaona\Documents\GitHub> go get -v gopkg.in/fatih/pool.v2
Fetching https://gopkg.in/fatih/pool.v2?go-get=1
https fetch failed.
Fetching http://gopkg.in/fatih/pool.v2?go-get=1
import "gopkg.in/fatih/pool.v2": http/https fetch: Get http://gopkg.in/fatih/poo
l.v2?go-get=1: dial tcp 107.178.216.236:80: ConnectEx tcp: A connection attempt
failed because the connected party did not properly respond after a period of ti
me, or established connection failed because connected host has failed to respon
d.
package gopkg.in/fatih/pool.v2: unrecognized import path "gopkg.in/fatih/pool.v2
"
While access 107.178.216.236:80 is OK in web browser.
I try to use go get github.com/fatih/pool, and it also works OK.
Could anyone give some clues on this issue?
BTW: I use windows powershell and git version is 1.9.5.
The root cause has been found: Because my computer use a web proxy, so I need to set proxy in environment variable:
C:\Users\xiaona>set https_proxy=https://web-proxy.corp.hp.com:8080/
C:\Users\xiaona>set http_proxy=https://web-proxy.corp.hp.com:8080/
C:\Users\xiaona>go get -v gopkg.in/fatih/pool.v2
Fetching https://gopkg.in/fatih/pool.v2?go-get=1
Parsing meta tags from https://gopkg.in/fatih/pool.v2?go-get=1 (status code 200)
get "gopkg.in/fatih/pool.v2": found meta tag main.metaImport{Prefix:"gopkg.in/fa
tih/pool.v2", VCS:"git", RepoRoot:"https://gopkg.in/fatih/pool.v2"} at https://g
opkg.in/fatih/pool.v2?go-get=1
gopkg.in/fatih/pool.v2 (download)
gopkg.in/fatih/pool.v2
Then, all is OK!