Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation updates #30770

Open
cybercrypt13 opened this Issue Mar 12, 2019 · 5 comments

Comments

Projects
None yet
5 participants
@cybercrypt13
Copy link

cybercrypt13 commented Mar 12, 2019

$ go version
go version go1.12 linux/amd64

In order to use go and be able to debug it, there are a few things that need to be done in order for it to work. I suggest you update the docs for installation because there are missing elements that make using it frustrating because it took me a few hours of googling before I figured out what was going on.

  1. GOPATH=~/go/ should be mentioned in your installation instructions as it is needed for a number of things for the environment to function.

  2. PATH shows adding export PATH=$PATH:/usr/local/go/bin to your .profile but it should also mention adding export PATH=$PATH:~/go/bin because you can't debug without it.

  3. You should mention on linux you need to install sudo apt install build-essential in order to debug go.

You have a page on debugging go with gdb but you mention not to use it but to use delve instead. But you don't have a page that I could find on installing and using delve either. The problem here is that the delve documentation is also incomplete and had me chasing two different things. Can't you at least supply basic information about using and installing delve if that is the only way to really do debugging?

Thanks,

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

ianlancetaylor commented Mar 12, 2019

Can you say exactly what documentation you are looking at? Thanks.

It should not be necessary to set GOPATH.

@cybercrypt13

This comment has been minimized.

Copy link
Author

cybercrypt13 commented Mar 12, 2019

https://golang.org/doc/install

You do need the GOPATH setup in order to install packages.
You also need to have GOPATH/bin setup in order to debug programs

Do I need it to write a simple go program? No, but all it serves is frustrating people later on. And not that later since you'll start installing packages pretty quickly.

@agnivade

This comment has been minimized.

Copy link
Member

agnivade commented Mar 13, 2019

You do need the GOPATH setup in order to install packages.

GOPATH has a default value of $HOME/go, so you don't need to explicitly set it. I agree that documentation can always be improved, but if you follow the https://golang.org/doc/install page carefully, it says

Before rushing off to write Go code please read the How to Write Go Code document, which describes some essential concepts about using the Go tools.

And once you go to that page, everything is clearly described. Moreover with 1.13, modules mode will be on by default and from there on, GOPATH will just fade into the background. To that effect, #28215 tracks updating that page to reflect how to write Go code using modules.

PATH shows adding export PATH=$PATH:/usr/local/go/bin to your .profile but it should also mention adding export PATH=$PATH:~/go/bin because you can't debug without it.

Also mentioned here - https://golang.org/doc/code.html#GOPATH

Can't you at least supply basic information about using and installing delve if that is the only way to really do debugging?

The page links to delve's installation page. I don't think duplicating installation instructions in multiple places will be helpful. If the installation instructions are incomplete, I would request you to ask in that repo instead of here.

@cybercrypt13

This comment has been minimized.

Copy link
Author

cybercrypt13 commented Mar 13, 2019

@ianlancetaylor ianlancetaylor added this to the Go1.13 milestone Mar 15, 2019

@adam-azarchs

This comment has been minimized.

Copy link
Contributor

adam-azarchs commented Mar 19, 2019

For what it's worth, something about the defaulting of GOPATH seems broken:

$ echo $HOME
/home/azarchs
$ (GOPATH="" GO111MODULE=on go env)
missing $GOPATH
$ go version
go version go1.12.1 linux/amd64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.