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

cmd/go: 'go get -d' does not diagnose dependencies with errors #41315

Closed
bcmills opened this issue Sep 10, 2020 · 5 comments
Closed

cmd/go: 'go get -d' does not diagnose dependencies with errors #41315

bcmills opened this issue Sep 10, 2020 · 5 comments
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Sep 10, 2020

go get -d “instructs get to download the source code needed to build the named packages, including downloading necessary dependencies ….”

As such, I would expect that if a dependency cannot be found or downloaded, or has a syntax error that prevents its own transitive dependencies from being identified, then go get should print an error and exit with a nonzero status code.
Instead, on all go versions I tested, it silently succeeds in the face of syntax errors.

example.com$ gotip get -d

example.com$ go1.15.2 get -d

example.com$ go1.14.9 get -d

example.com$ go1.13.15 get -d

-- go.mod --
module example.com

go 1.14
-- main.go --
package main

import _ "example.com/bogus"

func main() {}
-- bogus/bogus.go --
pack-age bogus

import "example.com/oops"

CC @jayconrod @matloob

@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 10, 2020
@bcmills bcmills added this to the Go1.16 milestone Sep 10, 2020
@bcmills bcmills self-assigned this Sep 10, 2020
@gopherbot
Copy link

Change https://golang.org/cl/254819 mentions this issue: cmd/go/internal/modget: warn about unmatched packages exactly once

@gopherbot
Copy link

Change https://golang.org/cl/254820 mentions this issue: cmd/go/internal/modget: factor out functions for argument resolution

gopherbot pushed a commit that referenced this issue Sep 15, 2020
Due to an inverted condition, we were emitting a "matched no packages"
warning twice in some cases and not at all in others.

For #41315

Change-Id: I472cd2d4f75811c8734852f2bdd7346f4c612816
Reviewed-on: https://go-review.googlesource.com/c/go/+/254819
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
gopherbot pushed a commit that referenced this issue Sep 15, 2020
For #37438
For #41315
For #36460

Change-Id: I17041c35ec91ff6ffb547e0f32572673d191b1ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/254820
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
@bcmills
Copy link
Contributor Author

bcmills commented Sep 18, 2020

You could argue (maybe) that we shouldn't error out due to syntax errors in go get -d, because the compiler will diagnose the syntax error anyway and doesn't require transitive dependencies in order to do that.

However, a similar problem can be reproduced with only missing imports (no syntax errors), which go get -d really should diagnose.

@gopherbot
Copy link

Change https://golang.org/cl/255969 mentions this issue: cmd/go/internal/modget: diagnose missing transitive dependencies

@gopherbot
Copy link

Change https://golang.org/cl/255970 mentions this issue: cmd/go/internal/modget: if building packages, only update go.mod if the build succeeds

gopherbot pushed a commit that referenced this issue Sep 22, 2020
For #41315

Change-Id: I3989bcb051ae57dd2d8f89759d241d4cdce49659
Reviewed-on: https://go-review.googlesource.com/c/go/+/255969
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
@golang golang locked and limited conversation to collaborators Sep 22, 2021
@rsc rsc unassigned bcmills Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

2 participants