Go get from GCP source repositories - go

I'm trying to go get a repository from GCP Source repositories.
This seems to be very very poorly documented but what I tried to do was running go get source.developers.google.com/p/[MY-PROJECT]/r/[MY_REPO].git.
But I got the error:
go: downloading source.developers.google.com/p/[MY-PROJECT]/r/[MY_REPO].git v0.0.0-20210621185528-a62b060bc13d
go get: source.developers.google.com/p/[MY-PROJECT]/r/[MY_REPO].git#v0.0.0-20210621185528-a62b060bc13d: verifying
module: source.developers.google.com/p/[MY-PROJECT]/r/[MY_REPO].git#v0.0.0-20210621185528-a62b060bc13d: reading https://sum.golang.org/lookup/source.developers.google.com/p/[MY-PROJECT]/r/[MY_REPO].git#v0.0.0-20210621185528-a62b060bc13d: 410 Gone
server response:
not found: source.developers.google.com/p/[MY-PROJECT]/r/[MY_REPO].git#v0.0.0-20210621185528-a62b060bc13d: invalid version: git fetch -f origin refs/heads/:refs/heads/ refs/tags/:refs/tags/ in /tmp/gopath/pkg/mod/cache/vcs/3eb4fda67ba3d1beb54fafd4a7594a34c06a66c44b1ffd91759a1b7362ecfa4d: exit status 128:
fatal: unable to connect to source.developers.google.com:
source.developers.google.com[0: 173.194.200.82]: errno=Connection refused
source.developers.google.com[1: 2607:f8b0:4003:c0d::52]: errno=Connection refused
How can I make it work?

Fixed by adding GOPRIVATE=source.developers.google.com. Seems that go mod was trying to use a public connection which was being refused by Source.

Related

TeamCity Error - Unable to collect Changes

I am getting an error in TeamCity When making a new private build. It is not picking up any changes.
The error is Failed to collect changes, error: git -c core.askpass=D:\TeamCity\install\temp\pass802548814093469879.bat -c credential.helper= ls-remote origin command failed.
exit code: 128
stderr: fatal: unable to access 'http://gitserver.xyz.com/pureohs/abc-def/': Failed to connect to gitserver.abcdef.com port 80 after 31 ms: Address already in use, VCS root: "git :: XYZ Template" {instance id=2027, parent internal id=183, parent id=GitABCXYZTemplate, description: "http://gitserver.xyz.com/abcdef/abc-def#master"}
i tried deleting the git cache, but this is not solving the problem. Please help me with the issue.
So i am trying to create a private build and get rid of this error.

Exporting dependencies from package which is existing vendor

I am new to golang and glide dependency management tool. I am trying to run glide install in created my company project. I have met an error about go-xorm library.
[ERROR] Update failed for github.com/go-xorm/xorm: Unable to get repository: Cloning into '/Users/xxx/.glide/cache/src/https-github.com-go-xorm-xorm'...
remote: Repository `go-xorm/xorm' is disabled.
remote: Please ask the owner to check their account.
fatal: unable to access 'https://github.com/go-xorm/xorm/': The requested URL returned error: 403
: exit status 128
[ERROR] Failed to checkout packages: Unable to get repository: Cloning into '/Users/xxx/.glide/cache/src/https-github.com-go-xorm-xorm'...
remote: Repository `go-xorm/xorm' is disabled.
remote: Please ask the owner to check their account.
fatal: unable to access 'https://github.com/go-xorm/xorm/': The requested URL returned error: 403
: exit status 128
It's seem that I am not able to download it from github because the owner made it disabled to clone.
How can I fix this error or Is there any way to export directly from local vendor without fetching from github. I am sure that the package is already on my local vendor folder. Thank you so much!!!
This is because XORM moved from Github (repo is still available as Public Archive) to Gitea and instead of github.com/go-xorm/xorm they now use xorm.io/xorm.
I'd recommend to stop using glide completely and replace it with Go Modules based workflow; but if you must use it, you will need to remove github.com/go-xorm/xorm from your glide.yaml, add xorm.io/xorm (you can use glide get to do so) and fix your imports everywhere in codebase.

Using golang-ci lint error fetch corp package

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

plugin install through proxy

I am trying to install Graph-Aided Search to integrate Neo4j with ElasticSearch (2.3.1) as shown here. But when I try this command line:
plugin install com.graphaware.es/graph-aided-search/2.3.2.0
I get errors:
plugin install com.graphaware.es/graph-aided-search/2.3.2.0
-> Installing com.graphaware.es/graph-aided-search/2.3.2.0...
Trying https://download.elastic.co/com.graphaware.es/graph-aided-search/graph-aided-search-2.3.2.0.zip ...
Trying https://search.maven.org/remotecontent?filepath=com/graphaware/es/graph-aided-search/2.3.2.0/graph-aided-search-2.3.2.0.zip ...
Trying https://oss.sonatype.org/service/local/repositories/releases/content/com/graphaware/es/graph-aided-search/2.3.2.0/graph-aided-search-2.3.2.0.zip ...
Trying https://github.com/com.graphaware.es/graph-aided-search/archive/2.3.2.0.zip ...
Trying https://github.com/com.graphaware.es/graph-aided-search/archive/master.zip ...
ERROR: failed to download out of all possible locations..., use --verbose to get detailed information
And this when I add --verbose for more details:
plugin install com.graphaware.es/graph-aided-search/2.3.2.0 --verbose
-> Installing com.graphaware.es/graph-aided-search/2.3.2.0...
Trying https://download.elastic.co/com.graphaware.es/graph-aided-search/graph-aided-search-2.3.2.0.zip ...
Failed: SocketTimeoutException[connect timed out]
Trying https://search.maven.org/remotecontent?filepath=com/graphaware/es/graph-aided-search/2.3.2.0/graph-aided-search-2.3.2.0.zip ...
Failed: SocketTimeoutException[connect timed out]
Trying https://oss.sonatype.org/service/local/repositories/releases/content/com/graphaware/es/graph-aided-search/2.3.2.0/graph-aided-search-2.3.2.0.zip ...
Failed: SocketTimeoutException[connect timed out]
Trying https://github.com/com.graphaware.es/graph-aided-search/archive/2.3.2.0.zip ...
Failed: SocketTimeoutException[connect timed out]
Trying https://github.com/com.graphaware.es/graph-aided-search/archive/master.zip ...
Failed: SocketTimeoutException[connect timed out]
ERROR: failed to download out of all possible locations..., use --verbose to get detailed information
I looked for that error on google and I found that it might be because of the proxy, and since I am working behind a proxy I tried something that basically worked for others. This is the command line that I tried to install the plugin through proxy:
C:\dev\elasticsearch-2.3.1\bin> plugin -Dhttps.proxyHost=http://example.test.fr -Dhttps.proxyPort=3128 -Dhttps.proxyUser=SomeUser -Dhttps.proxyPassword=Password install com.graphaware.es/graph-aided-search/2.3.2.0
But still it didn't work, and I am still getting the same error. I forced the authentification to the proxy on Internet Explorer, something that usually works for me when I install packages with Maven. However, in that case it didn't work.
I am struggling to integrate my Neo4j database with ElasticSearch, I have been trying that for 4days now and it is taking all my time and cannot work without making this integration with success.
I really appreciate any help or clarification to resolve this error. Thank you.
[UPDATE]
When I try to replace the path, it is still not working. I've tried this command line:
plugin install C:\dev\graph-aided-search-master\target\releases\graph-aided‌​-search-2.4.1.4-SNAP‌​SHOT.zip
and I got this error message:
-> Installing C:\dev\graph-aided-search-master\target\releases\graph-aided‌​-search-2.4.1.4-SNAP‌​SHOT.zip...
ERROR: Invalid prefix or suffix
I put the graph-aided-search Zip file in the same folder as plugin file, so in C:\dev\elasticsearch-2.3.1\bin. Then I tried with the relative path, and I got this message:
> plugin install graph-aided-search-2.4.1.4-SNAPSHOT.zip --verbose
-> Installing graph-aided-search-2.4.1.4-SNAPSHOT.zip...
Trying https://download.elastic.co/elasticsearch/release/org/elasticsearch/plugin/graph-aided-search-2.4.1.4-SNAPSHOT.zip/2.3.1/graph-aided-search-2.4.1.4-SNAPSHOT.zip-2.3.1.zip ...
Failed: SocketTimeoutException[connect timed out]
ERROR: failed to download out of all possible locations..., use --verbose to get detailed information
You can download the plugin manually from the MavenRepository
https://mvnrepository.com/artifact/com.graphaware.es/graph-aided-search
The correct syntax is this one:
plugin install com.graphaware.es/graph-aided-search/2.3.2.0 -DproxyHost=exampleHost -DproxyPort=portNumber
It is working now!

Why doesn't "go get gopkg.in/..." work while "go get github.com/..." OK?

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!

Resources