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
Related
I need to use kmac Hashicorp's Vault implementation. However, when I run the code, the following simple import:
import (
"encoding/hex"
"fmt"
"github.com/hashicorp/vault/sdk/helper/kmac"
)
throws this error: no required module provides package github.com/hashicorp/vault/sdk/helper/kmac/kmac; to add it: go get github.com/hashicorp/vault/sdk/helper/kmac/kmac
If I run:
go get github.com/hashicorp/vault/sdk/helper/kmac/kmac
I get:
go get: module github.com/hashicorp/vault/sdk#upgrade found (v0.2.0), but does not contain package github.com/hashicorp/vault/sdk/helper/kmac/kmac
I also tested to download the latest version but I get the same error. Can I get help?
I am getting the following error message in Go v. 1.15.8 darwin/amd64
main.go:8:2: cannot find package "github.com/google/subcommands" in any of:
/usr/local/go/src/github.com/google/subcommands (from $GOROOT)
/Users/user1/go/src/github.com/google/subcommands (from $GOPATH)
The code in main.go looks like:
package main
import (
"flag"
"context"
"os"
"github.com/google/subcommands"
)
I know subcommands is located here: https://github.com/google/subcommands
with the git repo here: https://github.com/google/subcommands.git
But how do I install it?
When I do:
go get github.com/google/subcommands
I get the following error message:
# cd .; git clone -- https://github.com/google/subcommands /Users/user1/go/src/github.com/google/subcommands
Cloning into '/Users/user1/go/src/github.com/google/subcommands'...
fatal: unable to access 'https://github.com/google/subcommands/': Could not resolve host: github.com
package github.com/google/subcommands: exit status 128
When I open my web browser and go to: https://github.com/google/subcommands/ I can see the web page with no problems. So why is the "go get" command having trouble with this?
What am I doing wrong?
In addition of git config, you can also check your environment variable for HTTP_PROXY/HTTPS_PROXY
But more importantly, check if adding GOPROXY=https://proxy.golang.org could help (there are other Go module proxies as well)
This could help getting modules from any provider, GitHub or others.
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.
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.