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

doc: miscellaneous documentation improvements #30770

Closed
cybercrypt13 opened this issue Mar 12, 2019 · 7 comments
Closed

doc: miscellaneous documentation improvements #30770

cybercrypt13 opened this issue Mar 12, 2019 · 7 comments
Labels
Documentation NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@cybercrypt13
Copy link

$ 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
Copy link
Contributor

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

It should not be necessary to set GOPATH.

@cybercrypt13
Copy link
Author

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
Copy link
Contributor

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
Copy link
Author

cybercrypt13 commented Mar 13, 2019 via email

@ianlancetaylor ianlancetaylor added this to the Go1.13 milestone Mar 15, 2019
@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 15, 2019
@adam-azarchs
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

@agnivade
Copy link
Contributor

agnivade commented Apr 8, 2019

@adam-azarchs - I am unable to reproduce your issue. If it still happens for you, please open a new issue.

paging @bcmills if something concrete can be done on this.

@adam-azarchs
Copy link
Contributor

Interesting... I can only seem to reproduce that on Windows's Linux Subsystem (Ubuntu running under a syscall translation layer, plus some filesystem emulation stuff). So feel free to ignore it, although I'm curious enough as to what about the environment is different enough from real linux to cause this behavior change.

@andybons andybons changed the title Documentation updates doc: miscellaneous documentation improvements May 14, 2019
@andybons andybons modified the milestones: Go1.13, Go1.14 Jul 8, 2019
@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

8 participants