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

Closed
wants to merge 2 commits into from

Conversation

elliotforbes
Copy link

@elliotforbes elliotforbes commented Oct 15, 2018

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

Updates #28215

@googlebot
Copy link

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 Used by googlebot to label PRs as having an invalid CLA. The text of this label should not change. label Oct 15, 2018
@elliotforbes
Copy link
Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change. and removed cla: no Used by googlebot to label PRs as having an invalid CLA. The text of this label should not change. labels Oct 15, 2018
@gopherbot
Copy link
Contributor

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

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

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

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

doc/code.html Outdated
@@ -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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good @elliotforbes

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@gopherbot
Copy link
Contributor

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

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

doc/code.html Outdated
@@ -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/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I've updated it!

@gopherbot
Copy link
Contributor

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

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

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 Used by googlebot to label PRs as having an invalid CLA. The text of this label should not change. and removed cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change. labels Oct 17, 2018
@gopherbot
Copy link
Contributor

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

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

@deanveloper
Copy link

deanveloper commented Oct 17, 2018

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

@elliotforbes
Copy link
Author

I signed it!

@googlebot
Copy link

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.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@deanveloper
Copy link

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

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

doc/code.html Outdated
</p>

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

@deanveloper deanveloper Oct 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've deleted other comments related to this

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@deanveloper deanveloper Oct 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@gopherbot
Copy link
Contributor

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

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!

@gopherbot
Copy link
Contributor

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

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

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

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

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

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

@gopherbot
Copy link
Contributor

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

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

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

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

@gopherbot
Copy link
Contributor

Message from Agniva De Sarker:

Patch Set 27:

Elliot, would you mind updating this with the latest and resolve the merge conflicts ? Then we can take this forward.


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

@gopherbot
Copy link
Contributor

Message from Andrew Bonventre:

Patch Set 27:

adding Jay to determine direction on this.


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

@gopherbot
Copy link
Contributor

Message from Jay Conrod:

Patch Set 27:

Patch Set 27:

adding Jay to determine direction on this.

Not quite ready to review this yet. It's likely we'll need to re-outline and rewrite this page and move it to x/website. I'm planning to do that in the next couple weeks as part of golang.org/issue/33637.

Sorry for the delay here.


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

@gopherbot gopherbot force-pushed the master branch 3 times, most recently from 53bd915 to 6139019 Compare October 3, 2019 21:09
@gopherbot gopherbot force-pushed the master branch 6 times, most recently from 4a7ed1f to 0f992b9 Compare November 5, 2019 02:57
@gopherbot
Copy link
Contributor

This PR is being closed because golang.org/cl/142297 has been abandoned.

Ended up doing a larger rewrite in CL 199417.

@gopherbot gopherbot closed this Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants