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.mod errors missing newlines on malformed replace blocks #27081

Closed
shoenig opened this issue Aug 19, 2018 · 5 comments
Closed

cmd/go: go.mod errors missing newlines on malformed replace blocks #27081

shoenig opened this issue Aug 19, 2018 · 5 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@shoenig
Copy link
Contributor

shoenig commented Aug 19, 2018

Having generated a malformed go.mod file**, an incorrect replace block produces error messages which appear to be missing newlines.

What version of Go are you using (go version)?

$ go version
go version go1.11rc1 linux/amd64

What did you expect to see?

Better formatted error messages, similar to what my malformed require block produced.

What did you see instead?

[k9 libconfig (master)] $ go build
go: errors parsing go.mod:
/home/hoenig/Documents/go/src/indeed/gophers/libconfig/go.mod:4: usage: require module/path v1.2.3
/home/hoenig/Documents/go/src/indeed/gophers/libconfig/go.mod:5: usage: require module/path v1.2.3
/home/hoenig/Documents/go/src/indeed/gophers/libconfig/go.mod:6: usage: require module/path v1.2.3
/home/hoenig/Documents/go/src/indeed/gophers/libconfig/go.mod:10: replacement module without version must be directory path (rooted or starting with ./ or ../)/home/hoenig/Documents/go/src/indeed/gophers/libconfig/go.mod:11: replacement module without version must be directory path (rooted or starting with ./ or ../)/home/hoenig/Documents/go/src/indeed/gophers/libconfig/go.mod:12: replacement module without version must be directory path (rooted or starting with ./ or ../)

Seems like that last line should be 3 lines.

The bad go.mod file:

$ cat go.mod 
module code.corp.indeed.com/gophers/libconfig

require (
    code.corp.indeed.com/gophers/3rdparty
    code.corp.indeed.com/gophers/libtest
    code.corp.indeed.com/gophers/rlog
)

replace (
    code.corp.indeed.com/gophers/3rdparty => gophers/3rdparty
    code.corp.indeed.com/gophers/libtest => gophers/libtest
    code.corp.indeed.com/gophers/rlog => gophers/rlog
)

** I'm working out how to adapt our internal tooling to work with modules while migrating from our gross monstrosity of a dependency manager; never mind the malformed-ness.

@mvdan
Copy link
Member

mvdan commented Aug 19, 2018

Thanks for reporting! It does seem like a few newlines were missed in fmt.Fprintf lines.

@mvdan mvdan added this to the Go1.11 milestone Aug 19, 2018
@mvdan mvdan added the NeedsFix The path to resolution is known, but the work has not been done. label Aug 19, 2018
@gopherbot
Copy link

Change https://golang.org/cl/129780 mentions this issue: cmd/go: add missing newlines in printf formats

@gopherbot
Copy link

Change https://golang.org/cl/129835 mentions this issue: [release-branch.go1.11] cmd/go: add missing newlines in printf formats

@zouyee
Copy link

zouyee commented Apr 19, 2019

屏幕快照 2019-04-19 上午9 35 03

@akshaybabloo
Copy link

I get this error in 1.12.* as well

@golang golang locked and limited conversation to collaborators Jun 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants