Archive for May, 2016

Using standard command “go get” for private golang packages on gitlab.com

I’m keeping my projects privately on gitlab.com and want to use for some of my golang packages standard “go get” command instead of using git clone/pull. When I’m trying to use standard commands I’m getting the error

go get gitlab.com/bykovme/my_package_here
# cd .; git clone https://gitlab.com/bykovme/my_package_here.git /home/bykov/gopath/src/gitlab.com/bykovme/my_package_here
Cloning into '/home/bykov/gopath/src/gitlab.com/bykovme/my_package_here'...
fatal: could not read Username for 'https://gitlab.com': terminal prompts disabled

As I’m using SSH keys to access the git repository, the following command solves the issue giving possibility to use standard go packages commands

git config --global url."git@gitlab.com:".insteadOf "https://gitlab.com/"

You can check if it was applied using the following command

cat ~/.gitconfig

The output of the command above should be like the text below

[url "git@gitlab.com:"]
    insteadOf = https://gitlab.com/

The command

go get gitlab.com/bykovme/my_package_here

is working now.

PS. The same solution is working for github.com

, , , , , , , ,

Leave a comment

Check cookies with curl

Currently set cookies can be retrieved with the command

curl -c - 'http://your-website-here.com'

or just use curl command request with parameter -v to check which cookies are set by this request

curl -v http://your-website-here.com

 

Leave a comment

md5 in Mac command line

md5 -s “Welcome”

Leave a comment

How to debug if you use goapp instead of go

I recently switched my editor for GOLANG from Sublime Text to Visual Studio Code using it together with plugin vscode-go. It is working perfectly and now there is much more pleasant to code in this IDE using GO. But I still missed one feature: debugger. vscode-go supports  visual debugging using delve but the issue is that I’m developing with go both for google application engine (GAE) and creating also usual go programs, dalve refused to work when I was trying to debug usual GO programs using GOAPP (I have just a symlink from ‘go’ to ‘goapp’ in SDK, no separate go is installed) giving me the following error:

couldn't detect GO version

Looks like the parser of dalve couldn’t detect version of GO because google adds to it additional information and the output of the command ‘go version’ looks like

go1.6 (appengine-1.9.35)

instead of the standard

go1.6

So, I decided that it can be fixed easily and found this check in the file go_version.go

Next thing I did, I just added the code below  in the check to remove this part “(appengine-1.9.35)” from version information, the change should go in line 27 just after ‘if strings.HasPrefix(ver, go) {‘ in the file go_version.go

    indexStart := strings.Index(ver, "(")
    if indexStart > 0 {
        indexEnd := strings.Index(ver, ")")
        if indexEnd > indexStart {
            ver = ver[:indexStart] + ver[indexEnd+1:]
            ver = strings.Trim(ver, " ")
        }
    }

Then I compiled/installed dalve  again and my debugger inside of Visual Studio Code started to work!

Enjoy!

, , , , , ,

Leave a comment