Go: cmd/go: align comments in go.mod files

Created on 31 Oct 2018  Â·  4Comments  Â·  Source: golang/go

Please answer these questions before submitting your issue. Thanks!

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

Go 1.11

Does this issue reproduce with the latest release?

yes

What did you do?

go mod init
go mod tidy

What did you expect to see?

Into go.mod, is it possible to have (like into comment into source code) align of // indirect

module myModule

require (
    github.com/something v1.0.0
    github.com/foo v1.0.0       // indirect
    github.com/foo/bar v1.0.0   // indirect 
)

What did you see instead?

module myModule

require (
    github.com/something v1.0.0
    github.com/foo v1.0.0  // indirect
    github.com/foo/bar v1.0.0 // indirect   
)
NeedsDecision modules

Most helpful comment

Personally, I'm not a big fan of alignment like that. it messes up diffs - what would be a single-line addition or removal of a dependency becomes a change to every line with a // indirect comment on.

Also, hopefully, we'll see many less // indirect comments as time goes on and more and more repositories get go.mod files, so this will become less of an issue over time.

All 4 comments

/cc @bcmills @rsc to see if we actually want to do this.

Personally, I'm not a big fan of alignment like that. it messes up diffs - what would be a single-line addition or removal of a dependency becomes a change to every line with a // indirect comment on.

Also, hopefully, we'll see many less // indirect comments as time goes on and more and more repositories get go.mod files, so this will become less of an issue over time.

Also, hopefully, we'll see many less // indirect comments as time goes on and more and more repositories get go.mod files, so this will become less of an issue over time.

It is appear to be acceptable.
Thx

As @rogpeppe notes, // indirect requirements should decrease over time.

(It's true that alignment add spurious diffs, but arguably diff -b — a.k.a. diff --ignore-space-change is a good default for Go development anyway, given gofmt.)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rakyll picture rakyll  Â·  3Comments

rsc picture rsc  Â·  3Comments

gopherbot picture gopherbot  Â·  3Comments

enoodle picture enoodle  Â·  3Comments

longzhizhi picture longzhizhi  Â·  3Comments