This repository was archived by the owner on Sep 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1k
Registry support #1381
Closed
Closed
Registry support #1381
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
859fbf5
Registry support
fd875f4
Registry support
4c0e97b
Registry support- merge
779a8f7
Registry support - REST API modifications
f0792af
Registry support - Bearer spelling fix
716976d
Registry support - deduct known paths
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
cmd/dep/testdata/harness_tests/ensure/registry/basic/final/Gopkg.lock
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
cmd/dep/testdata/harness_tests/ensure/registry/basic/final/Gopkg.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
[[constraint]] | ||
name = "github.com/sdboyer/deptesttres" | ||
version = "1.0.0" | ||
|
||
[[constraint]] | ||
name = "github.com/sdboyer/deptest" | ||
version = "1.0.0" |
13 changes: 13 additions & 0 deletions
13
cmd/dep/testdata/harness_tests/ensure/registry/basic/initial/main.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2017 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package main | ||
|
||
import ( | ||
"github.com/sdboyer/deptesttres" | ||
) | ||
|
||
func main() { | ||
type a deptesttres.Bar | ||
} |
14 changes: 14 additions & 0 deletions
14
cmd/dep/testdata/harness_tests/ensure/registry/basic/testcase.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"env": { | ||
"DEPREGISTRYURL": "http://localhost:9090", | ||
"DEPREGISTRYTOKEN": "2erygdasE45rty5JKwewrr75cb15rdeE" | ||
}, | ||
"commands": [ | ||
["init", "-no-examples"], | ||
["ensure", "-add", "github.com/sdboyer/deptest"] | ||
], | ||
"vendor-final": [ | ||
"github.com/sdboyer/deptest", | ||
"github.com/sdboyer/deptesttres" | ||
] | ||
} |
21 changes: 21 additions & 0 deletions
21
cmd/dep/testdata/harness_tests/init/registry/basic/final/Gopkg.lock
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
cmd/dep/testdata/harness_tests/init/registry/basic/final/Gopkg.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
[[constraint]] | ||
name = "github.com/sdboyer/deptest" | ||
version = "1.0.0" | ||
|
||
[[constraint]] | ||
name = "github.com/sdboyer/deptestdos" | ||
version = "2.0.0" |
13 changes: 13 additions & 0 deletions
13
cmd/dep/testdata/harness_tests/init/registry/basic/initial/foo/bar.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2017 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package foo | ||
|
||
import "github.com/sdboyer/deptest" | ||
|
||
func Foo() deptest.Foo { | ||
var y deptest.Foo | ||
|
||
return y | ||
} |
19 changes: 19 additions & 0 deletions
19
cmd/dep/testdata/harness_tests/init/registry/basic/initial/main.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2017 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/golang/notexist/foo" | ||
"github.com/sdboyer/deptestdos" | ||
) | ||
|
||
func main() { | ||
var x deptestdos.Bar | ||
y := foo.FooFunc() | ||
|
||
fmt.Println(x, y) | ||
} |
14 changes: 14 additions & 0 deletions
14
cmd/dep/testdata/harness_tests/init/registry/basic/testcase.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"env": { | ||
"DEPREGISTRYURL": "http://localhost:9090", | ||
"DEPREGISTRYTOKEN": "2erygdasE45rty5JKwewrr75cb15rdeE" | ||
}, | ||
"commands": [ | ||
["init", "-no-examples"] | ||
], | ||
"error-expected": "", | ||
"vendor-final": [ | ||
"github.com/sdboyer/deptest", | ||
"github.com/sdboyer/deptestdos" | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This entails at least one HTTP request for each root path, including the known path case (which was removed above, compared with
deductionCoordinator.deduceRootPath()
). This will be a notable performance hit for the user vs. the current behavior.More importantly, though, as long as we are guaranteeing that any proxy registry can access and passthrough-cache any upstream VCS source that a dep client would be able to access itself without an intermediate registry, then, then i see no compelling use case for having this extra request. In fact, all i see is a vector for confusion and errors, as we become reliant on registries to respect naming invariants that are presently universal, by virtue of being encoded in the tool. It seems like it should be possible - at least as a first pass approach - to just rely on the existing static deduction subsystem, then perform some structured transformations on the
pathDeduction
s that they return.Is there a crucial use case that's serviced by making this request to the registry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Yes, it would be preferable to deduct the root project path without HTTP request. I added the known paths deduction to address this issue.
However, for imports that are not using well known URLs, passthrough upstream VCS source is not always possible. For instance, in a closed network environment that work exclusively through a private registry deducing the project root by querying the VCS repository for the goget metadata cannot work (leaving aside the fact that most of the benefits of having a local private registry are lost by bypassing and accessing the sources directly).
Therefore, there is a valid use case IMO for having the registry know about the project roots it hosts. Once, we allowed static deduction to kick in first I don't think the performance impact (a single HEAD call) would be an issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great 😄
for sure, i'm entirely in agreement that anything requiring normal
go-get
HTTP metadata deduction can be forwarded to the registry.agreed, that's no net increase in the number of HTTP requests, so no harm done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great. Is it ready to be merged?