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/code.html: update code.html to use go modules #28218

Open
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
6 participants
@elliotforbes
Copy link

elliotforbes commented Oct 15, 2018

This starts to update the doc/code.html article to use go modules.

Updates #28215

@googlebot

This comment has been minimized.

Copy link

googlebot commented Oct 15, 2018

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@googlebot googlebot added the cla: no label Oct 15, 2018

@elliotforbes

This comment has been minimized.

Copy link
Author

elliotforbes commented Oct 15, 2018

I signed it!

@googlebot

This comment has been minimized.

Copy link

googlebot commented Oct 15, 2018

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no labels Oct 15, 2018

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Oct 15, 2018

This PR (HEAD: aedc7dd) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/142297 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Oct 15, 2018

Message from Gerrit User 5976:

Patch Set 1:

Congratulations on opening your first change. Thank you for your contribution!

Next steps:
Within the next week or so, a maintainer will review your change and provide
feedback. See https://golang.org/doc/contribute.html#review for more info and
tips to get your patch through code review.

Most changes in the Go project go through a few rounds of revision. This can be
surprising to people new to the project. The careful, iterative review process
is our way of helping mentor contributors and ensuring that their contributions
have a lasting impact.

During May-July and Nov-Jan the Go project is in a code freeze, during which
little code gets reviewed or merged. If a reviewer responds with a comment like
R=go1.11, it means that this CL will be reviewed as part of the next development
cycle. See https://golang.org/s/release for more details.


Please don’t reply on this GitHub thread. Visit golang.org/cl/142297.
After addressing review feedback, remember to publish your drafts!

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Oct 16, 2018

This PR (HEAD: a04f722) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/142297 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Oct 16, 2018

This PR (HEAD: 72b2c69) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/142297 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@@ -202,25 +202,35 @@ <h3 id="ImportPaths">Import paths</h3>
</p>

<p>
We'll use <code>github.com/user</code> as our base path. Create a directory
inside your workspace in which to keep source code:
We'll use <code>github.com/user</code> as our base path for our Go programs. Create a new

This comment has been minimized.

Copy link
@deanveloper

deanveloper Oct 16, 2018

We should stop using github.com/user as the base path for our program with modules. Instead, they should just be able to do something like create a folder on their desktop or in Documents or something. Also this looks like a windows-specific path

This comment has been minimized.

Copy link
@mdwhatcott

mdwhatcott Oct 16, 2018

Also, as stated on the wiki entry about modules, the opt-in nature of modules in go 1.11 currently requires that modules be used outside of a GOPATH unless the GO111MODULE environment variable is correctly set (GO111MODULE=on).

This comment has been minimized.

Copy link
@elliotforbes

elliotforbes Oct 16, 2018

Author

@mdwhatcott I wasn't sure whether to write this from a Go 1.12 point of view, in which setting the environment variable will be redundant (I think?). I'll update this though to reflect current release and ensure it's easily delete-able.

@deanveloper If the go mod init command can't automatically determine the module path from the likes of VCS meta-data then you need to supply the module path. I felt keeping github.com/user was consistent with the rest of the content already there and would minimize confusion if the user hadn't already run git init + git remote add origin ....

To both - I can add a line that explicitly states that the new project directory be created outside of the GOPATH and within a directory the user is comfortable with?

This comment has been minimized.

Copy link
@mdwhatcott

This comment has been minimized.

Copy link
@elliotforbes

elliotforbes Oct 17, 2018

Author

@mdwhatcott + @deanveloper I've updated the page to include both your suggestions. Have a look and let me know what you think :)

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Oct 16, 2018

This PR (HEAD: 03c2e5f) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/142297 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Oct 17, 2018

This PR (HEAD: 0567c22) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/142297 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@@ -302,7 +315,7 @@ <h3 id="Command">Your first program</h3>
</p>

<pre>
$ <b>cd $GOPATH/src/github.com/user/hello</b>
$ <b>cd ~/myproject/hello</b>
$ <b>git init</b>
Initialized empty Git repository in /home/user/work/src/github.com/user/hello/.git/

This comment has been minimized.

Copy link
@mdwhatcott

mdwhatcott Oct 17, 2018

I think the output of this git init command needs to be updated:

Suggested change
Initialized empty Git repository in /home/user/work/src/github.com/user/hello/.git/
Initialized empty Git repository in /home/user/myproject/hello/.git/

This comment has been minimized.

Copy link
@elliotforbes

elliotforbes Oct 17, 2018

Author

Good catch, I've updated it!

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Oct 17, 2018

This PR (HEAD: 01ca903) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/142297 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

Show resolved Hide resolved doc/code.html Outdated
Show resolved Hide resolved doc/code.html Outdated
@googlebot

This comment has been minimized.

Copy link

googlebot commented Oct 17, 2018

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

@googlebot googlebot added cla: no and removed cla: yes labels Oct 17, 2018

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Oct 17, 2018

This PR (HEAD: bcdb292) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/142297 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@deanveloper

This comment has been minimized.

Copy link

deanveloper commented Oct 17, 2018

oops ill fix the cla stuff, apparently I get attributed if I suggest a change?

@deanveloper

This comment has been minimized.

Copy link

deanveloper commented Oct 17, 2018

Signed it although looks like @elliotforbes needs to comment to get it to check :P

@elliotforbes

This comment has been minimized.

Copy link
Author

elliotforbes commented Oct 17, 2018

I signed it!

@googlebot

This comment has been minimized.

Copy link

googlebot commented Oct 17, 2018

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

$ <b>go install</b>
$ <b>go install github.com/user/hello</b>
$ <b>$HOME/go/bin/hello</b>
hello, world.

This comment has been minimized.

Copy link
@deanveloper

deanveloper Oct 17, 2018

Looks like we run the code further down in the tutorial, don't need it twice

This comment has been minimized.

Copy link
@elliotforbes

elliotforbes Oct 17, 2018

Author

Done, you may have to comment "I signed it!" though, looks like the original attempt may have failed.

@deanveloper

This comment has been minimized.

Copy link

deanveloper commented Oct 17, 2018

Won't let me comment inline for this one, as no changes were made to this area, but here we still have GOPATH code in the libraries section

@deanveloper

This comment has been minimized.

Copy link

deanveloper commented Oct 17, 2018

It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

Looks like we'll need a member to set the CLA label

</p>

<pre>
$ <b>mkdir $GOPATH/src/github.com/user/stringutil</b>
$ <b>mkdir ~/myproject/hello/stringutil</b>

This comment has been minimized.

Copy link
@deanveloper

deanveloper Oct 17, 2018

Perhaps it's better it's a separate package rather than a subpackage of github.com/user/hello?

Also need to change some code a few lines up so this "suggestion" only really applies to the line this comment was made on 😅

Also don't forget go mod init github.com/user/stringutil!

Suggested change
$ <b>mkdir ~/myproject/hello/stringutil</b>
$ <b>mkdir ~/myproject/stringutil</b>

This comment has been minimized.

Copy link
@elliotforbes

elliotforbes Oct 17, 2018

Author

I had that originally, but AFAIK it requires a VCS repository behind it? You'd have to ask them to create a repo, create the package and then go through all the steps in order to import the package to their original application which seems slightly complex for what should be an introductory article?

What do you think?

This comment has been minimized.

Copy link
@deanveloper

deanveloper Oct 17, 2018

That's true, and it would be pretty annoying to do... Not sure in this case. Maybe it would be good to have it as a subdirectory?

This comment has been minimized.

Copy link
@elliotforbes

elliotforbes Oct 17, 2018

Author

We cover remote packages further down in the document, might be worthwhile extending that section to show an example of this in more depth and keeping the first bit simpler?

This comment has been minimized.

Copy link
@deanveloper

deanveloper Oct 17, 2018

I've deleted other comments related to this

This comment has been minimized.

Copy link
@deanveloper

deanveloper Oct 17, 2018

We cover remote packages further down in the document, might be worthwhile extending that section to show an example of this in more depth and keeping the first bit simpler?

Are there other documents explaining importing external packages? If so then we shouldn't need to do this

hello.go # command source
stringutil/
reverse.go # package source
</pre>

This comment has been minimized.

Copy link
@deanveloper

deanveloper Oct 17, 2018

Why are we removing all of this? It's useful information. It'll need the go.mod files in there though

@elliotforbes elliotforbes force-pushed the elliotforbes:master branch from c0cc18a to 8df70a0 Dec 23, 2018

@googlebot

This comment has been minimized.

Copy link

googlebot commented Dec 23, 2018

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no labels Dec 23, 2018

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Dec 23, 2018

This PR (HEAD: 8df70a0) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/142297 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Dec 23, 2018

This PR (HEAD: 85502db) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/142297 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Dec 23, 2018

This PR (HEAD: 506728f) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/142297 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@elliotforbes elliotforbes force-pushed the elliotforbes:master branch from 506728f to f789b0a Dec 23, 2018

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Dec 23, 2018

This PR (HEAD: f789b0a) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/142297 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@elliotforbes elliotforbes force-pushed the elliotforbes:master branch from f789b0a to bd00425 Dec 23, 2018

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Dec 23, 2018

This PR (HEAD: bd00425) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/142297 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@elliotforbes elliotforbes force-pushed the elliotforbes:master branch from bd00425 to ed06365 Dec 23, 2018

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Dec 23, 2018

This PR (HEAD: ed06365) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/142297 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@elliotforbes

This comment has been minimized.

Copy link
Author

elliotforbes commented Dec 23, 2018

@andybons - Think I've cracked it now! Can you let me know if this is ok?

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Dec 23, 2018

Message from thepudds:

Patch Set 23:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/142297.
After addressing review feedback, remember to publish your drafts!

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Dec 23, 2018

Message from Andrew Bonventre:

Patch Set 23:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/142297.
After addressing review feedback, remember to publish your drafts!

@elliotforbes elliotforbes force-pushed the elliotforbes:master branch from ed06365 to a697395 Dec 24, 2018

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Dec 24, 2018

This PR (HEAD: a697395) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/142297 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Dec 24, 2018

Message from Elliot Forbes:

Patch Set 24:

(1 comment)

Patch Set 23:

(1 comment)

I've updated the list here taking your comments into account, let me know if these need further work.


Please don’t reply on this GitHub thread. Visit golang.org/cl/142297.
After addressing review feedback, remember to publish your drafts!

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Dec 24, 2018

Message from Elliot Forbes:

Patch Set 24:

Patch Set 23:

(1 comment)

This should hopefully be fixed now, it was an auto-format issue.


Please don’t reply on this GitHub thread. Visit golang.org/cl/142297.
After addressing review feedback, remember to publish your drafts!

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Dec 24, 2018

Message from Andrew Bonventre:

Patch Set 24: Code-Review+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/142297.
After addressing review feedback, remember to publish your drafts!

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Dec 24, 2018

Message from Agniva De Sarker:

Patch Set 24:

(4 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/142297.
After addressing review feedback, remember to publish your drafts!

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Dec 24, 2018

This PR (HEAD: 84bc96b) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/142297 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@elliotforbes elliotforbes force-pushed the elliotforbes:master branch from 84bc96b to 28bbe51 Dec 24, 2018

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Dec 24, 2018

This PR (HEAD: 28bbe51) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/142297 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Dec 24, 2018

Message from Elliot Forbes:

Patch Set 26:

(4 comments)

Patch Set 24:

(4 comments)

I believe I've addressed all comments, let me know if anything further is needed :)


Please don’t reply on this GitHub thread. Visit golang.org/cl/142297.
After addressing review feedback, remember to publish your drafts!

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Dec 24, 2018

Message from Agniva De Sarker:

Patch Set 26:

Patch Set 26:

(4 comments)

Patch Set 24:

(4 comments)

I believe I've addressed all comments, let me know if anything further is needed :)

Thanks Elliot. Since you have marked this CL as "Updates #28215", I believe you have more content planned ? It would be good if you can create a CL series updating the page in chunks. Then it can be reviewed keeping the final state of the page in mind.

Also adding Rob to take a look.


Please don’t reply on this GitHub thread. Visit golang.org/cl/142297.
After addressing review feedback, remember to publish your drafts!

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Jan 12, 2019

This PR (HEAD: 012ead1) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/142297 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

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.