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 · 4 comments

Comments

Projects
None yet
4 participants
@shoenig
Copy link
Contributor

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

This comment has been minimized.

Copy link
Member

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 label Aug 19, 2018

@gopherbot

This comment has been minimized.

Copy link

commented Aug 19, 2018

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

@gopherbot gopherbot closed this in e0faedb Aug 20, 2018

@gopherbot

This comment has been minimized.

Copy link

commented Aug 20, 2018

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

@zouyee

This comment has been minimized.

Copy link

commented Apr 19, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.