forked from golang/tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/lsp: handle exclude directives in multi-module mode
Add exclude directives to the workspace module go.mod file. Fixes golang/go#44932 Change-Id: I93f587b321dc6b35e7df30ea39cf8f70f656d04c Reviewed-on: https://go-review.googlesource.com/c/tools/+/317449 Trust: Rebecca Stambler <[email protected]> Run-TryBot: Rebecca Stambler <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Robert Findley <[email protected]>
- Loading branch information
1 parent
f4a4129
commit 08a4f34
Showing
2 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -242,6 +242,66 @@ func Hello() int { | |
}) | ||
} | ||
|
||
func TestMultiModuleWithExclude(t *testing.T) { | ||
testenv.NeedsGo1Point(t, 16) | ||
|
||
const proxy = ` | ||
-- [email protected]/go.mod -- | ||
module c.com | ||
go 1.12 | ||
require b.com v1.2.3 | ||
-- [email protected]/blah/blah.go -- | ||
package blah | ||
func SaySomething() { | ||
fmt.Println("something") | ||
} | ||
-- [email protected]/go.mod -- | ||
module b.com | ||
go 1.12 | ||
-- [email protected]/b/b.go -- | ||
package b | ||
func Hello() {} | ||
-- [email protected]/go.mod -- | ||
module b.com | ||
go 1.12 | ||
-- [email protected]/b/b.go -- | ||
package b | ||
func Hello() {} | ||
` | ||
const multiModule = ` | ||
-- go.mod -- | ||
module a.com | ||
require c.com v1.2.3 | ||
exclude b.com v1.2.3 | ||
-- go.sum -- | ||
c.com v1.2.3 h1:n07Dz9fYmpNqvZMwZi5NEqFcSHbvLa9lacMX+/g25tw= | ||
c.com v1.2.3/go.mod h1:/4TyYgU9Nu5tA4NymP5xyqE8R2VMzGD3TbJCwCOvHAg= | ||
-- main.go -- | ||
package a | ||
func main() { | ||
var x int | ||
} | ||
` | ||
WithOptions( | ||
ProxyFiles(proxy), | ||
Modes(Experimental), | ||
).Run(t, multiModule, func(t *testing.T, env *Env) { | ||
env.Await( | ||
env.DiagnosticAtRegexp("main.go", "x"), | ||
) | ||
}) | ||
} | ||
|
||
// This change tests that the version of the module used changes after it has | ||
// been deleted from the workspace. | ||
func TestDeleteModule_Interdependent(t *testing.T) { | ||
|
This file contains 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