This is an archive of the discontinued LLVM Phabricator instance.

Introduce Go coding standards for LLVM.
ClosedPublic

Authored by pcc on Oct 13 2014, 2:34 PM.

Details

Summary

Rather than define our own standards, we adopt a set of best practices that
are already in use by the Go community.

Diff Detail

Repository
rL LLVM

Event Timeline

pcc updated this revision to Diff 14824.Oct 13 2014, 2:34 PM
pcc retitled this revision from to Introduce Go coding standards for LLVM..
pcc updated this object.
pcc edited the test plan for this revision. (Show Details)
pcc added reviewers: chandlerc, ruiu.
pcc added a subscriber: Unknown Object (MLST).
pcc updated this revision to Diff 14827.Oct 13 2014, 2:59 PM
pcc edited edge metadata.

Add link to Go Code Review Comments

ruiu added a comment.Oct 13 2014, 3:10 PM

LGTM but I don't think I'm the decider on this.

From the Go programmer's point of view, this is a welcomed policy. It's widely accepted that there's one Go coding style and no more than that. Suggestions to make another policy or alter the default policy usually get strong pushbacks.

rnk added a subscriber: rnk.Oct 13 2014, 3:44 PM
rnk added inline comments.
docs/CodingStandards.rst
182–184 ↗(On Diff #14827)

We should probably just say that none of these conventions apply to non-C-family languages. Our Python bindings and lit are basically PEP8 style, for example.

chandlerc accepted this revision.Oct 13 2014, 3:58 PM
chandlerc edited edge metadata.

I think this is fine. I'd like to see Reid's comments addressed, but I don't think this patch is really a step backwards in any sense.

docs/CodingStandards.rst
182–184 ↗(On Diff #14827)

I'm fine with clarifying that in a further patch if you want, but I also think its totally fine for us to actually state that Go code, if it exists in LLVM, should follow the gofmt and idiomatic patterns documented by the Go folks.

This revision is now accepted and ready to land.Oct 13 2014, 3:58 PM
ruiu added inline comments.Oct 13 2014, 3:59 PM
docs/CodingStandards.rst
182–184 ↗(On Diff #14827)

But if we don't say anything about the coding standard, it would be continually raised what new code should look like. Because we are going to check in considerable amount of Go code as a Go frontend written in Go, I'd like to have a clear rule here.

chandlerc added inline comments.Oct 13 2014, 5:20 PM
docs/CodingStandards.rst
182–184 ↗(On Diff #14827)

I mean, I agree that we should say something and something specific for Go. We can *also* say that any languages not covered explicitly here should <something_i_haven't_thought_about>, but it seems fine to add explicit guidance for Go now.

pcc closed this revision.Oct 13 2014, 5:51 PM
pcc updated this revision to Diff 14847.

Closed by commit rL219646 (authored by @pcc).