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

x/net/http2/h2demo: should not be single-handedly responsible for adding 3 required modules to x/net #30685

Closed
dmitshur opened this issue Mar 8, 2019 · 18 comments
Labels
ExpertNeeded FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@dmitshur
Copy link
Contributor

dmitshur commented Mar 8, 2019

The golang.org/x/net module holds supplementary Go networking libraries. It currently requires 5 modules:

require (
	cloud.google.com/go v0.36.0
	go4.org v0.0.0-20190218023631-ce4c26f7be8e
	golang.org/x/build v0.0.0-20190307215223-c78805dbabc8
	golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25
	golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2
)

The h2demo package is single-handedly responsible for x/net requiring cloud.google.com/go, go4.org, and golang.org/x/build modules (it has a // +build h2demo build constraint, but that doesn't have any effect when computing module requirements):

https://github.com/golang/net/blob/16b79f2e4e95ea23b2bf9903c9809ff7b013ce85/http2/h2demo/h2demo.go#L31-L33

The x/net module should not be requiring x/build (and in turn, the world, due to #29935).

If the h2demo package is removed, the list of required modules in x/net becomes just:

require (
	golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25
	golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2
)

I see 2 possible paths to resolve this:

  1. move h2demo somewhere else (to x/build?)
  2. make h2demo a separate module in x/net by adding a go.mod file to it, in effect cutting it and its required modules off from the rest of x/net

Based on the content of the h2demo directory and the fact it's a part of our infrastructure (i.e., it's the server powering http2.golang.org), I suggest we move h2demo to x/build. It can use the http2 package by requiring x/net module. @bradfitz How does that sound to to you?

/cc @bradfitz @matloob @bcmills

@dmitshur dmitshur added ExpertNeeded NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. modules labels Mar 8, 2019
@gopherbot gopherbot added this to the Unreleased milestone Mar 8, 2019
@bcmills
Copy link
Contributor

bcmills commented Mar 8, 2019

Either solution SGTM.

@bradfitz
Copy link
Contributor

bradfitz commented Mar 8, 2019

I'd rather not move it away from the code that it's a demo of.

@bcmills
Copy link
Contributor

bcmills commented Mar 8, 2019

Are you ok with carving it out into its own module, keeping it at the same path (and in the same repo)?

@dmitshur
Copy link
Contributor Author

dmitshur commented Mar 8, 2019

Ok. If Brad is okay with making it a separate module in x/net instead, I want @matloob and @ianthehat's agreement of introducing a multi-module repository in order to resolve this issue.

I propose making it a separate module but not making any tagged releases yet, which is more in line with @bcmills's plan described in #28136 (comment) that we have been following so far for all subrepos.

Edit: I don't yet know if it's better to include a replace golang.org/x/net => ../.. directive in the h2demo module's go.mod file, or to leave it out. This would need to be figured out.

@bradfitz
Copy link
Contributor

bradfitz commented Mar 8, 2019

Are you ok with carving it out into its own module, keeping it at the same path (and in the same repo)?

That's fine with me, and shouldn't impact its users, since its users are approximately 1-2 people (us).

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/166337 mentions this issue: http2/h2demo: carve out into a separate module

@dmitshur
Copy link
Contributor Author

dmitshur commented Mar 8, 2019

I've created CL 166337 that implements the carving of h2demo out into a separate module. Please feel free to review it.

If CL 162822 (adding a root go.mod to golang.org/x/net module) is rebased on top of it and updated, the x/net root go.mod file becomes just:

module golang.org/x/net

require (
	golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25
	golang.org/x/text v0.3.0
)

Before we can proceed, I'm waiting to make sure @matloob and @ianthehat are okay with the decision of creating a new golang.org/x/net/http2/h2demo module (in order to resolve this issue).

@matloob
Copy link
Contributor

matloob commented Mar 8, 2019

I'd be okay with it, as long as we put in a replace directive in net pointing to the local h2demo.

@dmitshur
Copy link
Contributor Author

dmitshur commented Mar 8, 2019

a replace directive in net pointing to the local h2demo.

Do you mean a replace directive in h2demo, pointing to the local x/net?

I can add that to CL 166337. Deciding on whether to commit a replace golang.org/x/net => ../.. directive is something I mentioned in #30685 (comment).

@dmitshur
Copy link
Contributor Author

dmitshur commented Mar 8, 2019

I can add that to CL 166337.

Actually, I can't, because it requires the go.mod file to exist at ../../go.mod, which will happen after CL 162822 is merged.

Do you want make adding the replace directive a part of your CL instead?

@dmitshur
Copy link
Contributor Author

dmitshur commented Mar 8, 2019

Alternatively, it may make more sense to add the root go.mod file first, and carve out h2demo into a separate module second. @matloob Thoughts on that?

@matloob
Copy link
Contributor

matloob commented Mar 8, 2019

Sure, that's okay

@pwaller
Copy link
Contributor

pwaller commented Mar 8, 2019

I'd be okay with it, as long as we put in a replace directive in net pointing to the local h2demo.

It would be interesting for those of us following along at home (:wave:) to know what is the effect you desire from this choice. Asking because I want to understand the thought processes and perhaps apply the same ideas elsewhere.

@dmitshur
Copy link
Contributor Author

dmitshur commented Mar 8, 2019

The effect of having a replace golang.org/x/net => ../.. directive in the future golang.org/x/net/http2/h2demo module is that when you're doing local development, it will use the version of golang.org/x/net that is on your disk two parent directories up, instead of the version specified in the http2/h2demo/go.mod file.

It also means any local changes to the http2, etc., packages from golang.org/x/net module will be picked up when building or testing h2demo.

@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. labels Mar 8, 2019
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/162822 mentions this issue: all: add go.mod files, carve h2demo into separate module

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/166857 mentions this issue: http2/h2demo: require golang.org/x/net@latest

gopherbot pushed a commit to golang/net that referenced this issue Mar 11, 2019
Now that a pseudo-version of golang.org/x/net with h2demo carved exists,
we can depend on it. Add the dependency to h2demo's go.mod file.

Updates golang/go#30685

Change-Id: I3dbb2493d97be381350881228025d27c7e8e8623
Reviewed-on: https://go-review.googlesource.com/c/net/+/166857
Run-TryBot: Michael Matloob <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/196036 mentions this issue: http2/h2demo: remove h2demo build constraint

gopherbot pushed a commit to golang/net that referenced this issue Sep 18, 2019
The build constraint is no longer useful. It doesn't prevent this
package contributing module requirements to x/net, that was already
resolved by carving h2demo into its own module in golang/go#30685.
Few people do go get -u golang.org/x/net/... in GOPATH mode by now,
so there's no need to optimize for avoiding polluting GOPATH/bin.

Removing the build constraint allows the package to be visible and
tested by trybots and builders. It's also simpler.

Fixes golang/go#34361

Change-Id: I84b5d70aab210ca8e4f5494160ae4d9049ef08ad
Reviewed-on: https://go-review.googlesource.com/c/net/+/196036
Run-TryBot: Dmitri Shuralyov <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Bryan C. Mills <[email protected]>
Reviewed-by: Brad Fitzpatrick <[email protected]>
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/198917 mentions this issue: [release-branch.go1.13] http2/h2demo: remove h2demo build constraint

gopherbot pushed a commit to golang/net that referenced this issue Oct 4, 2019
The build constraint is no longer useful. It doesn't prevent this
package contributing module requirements to x/net, that was already
resolved by carving h2demo into its own module in golang/go#30685.
Few people do go get -u golang.org/x/net/... in GOPATH mode by now,
so there's no need to optimize for avoiding polluting GOPATH/bin.

Removing the build constraint allows the package to be visible and
tested by trybots and builders. It's also simpler.

Updates golang/go#34361

Change-Id: I84b5d70aab210ca8e4f5494160ae4d9049ef08ad
Reviewed-on: https://go-review.googlesource.com/c/net/+/196036
Run-TryBot: Dmitri Shuralyov <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Bryan C. Mills <[email protected]>
Reviewed-by: Brad Fitzpatrick <[email protected]>
(cherry picked from commit a8b05e9)
Reviewed-on: https://go-review.googlesource.com/c/net/+/198917
@golang golang locked and limited conversation to collaborators Oct 3, 2020
dteh pushed a commit to dteh/fhttp that referenced this issue Jun 22, 2022
This change adds a go.mod and go.sum file to this repo, following the
requirements stated in bcmills's comment here:
https://golang.org/issue/28136#issuecomment-462971974. It's
important to note that we will not be
adding versions to the repo for now.

This change also creates a new module with the module path
golang.org/x/net/http2/h2demo, and moves the h2demo command into it.
This is done by adding a go.mod file in the http2/h2demo directory.
As a result, the h2demo command and its dependencies are removed
from this and later pseudo-versions of the golang.org/x/net module.

The change was generated using Go 1.12.

Updates golang/go#28136
Fixes golang/go#30685

Change-Id: Ia5b0f6623c3374355b76106432190a0c9acf3d05
Reviewed-on: https://go-review.googlesource.com/c/net/+/162822
Run-TryBot: Michael Matloob <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ExpertNeeded FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

6 participants