Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions acme/acmego/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// The other known extensions and formatters are:
//
// .rs - rustfmt
// .cpp, .c, .cc, .cu, .cxx, .h, .hh, .hpp, .hxx, .tcc, .mm, .m - clang-format
//
package main

Expand Down Expand Up @@ -50,12 +51,22 @@ var otherFormatters = map[string][]string{
".rs": []string{"rustfmt", "--emit", "stdout"},
}

// Clang formatters (only loaded with -f option).
var clangSuffixes = []string{
".cpp", ".c", ".cc", ".cu", ".cxx", ".h", ".hh", ".hpp", ".hxx", ".tcc", ".mm", ".m",
}

var clangFormat = []string{"clang-format"}

func main() {
flag.Parse()
if *gofmt {
for suffix, formatter := range otherFormatters {
formatters[suffix] = formatter
}
for _, suffix := range clangSuffixes {
formatters[suffix] = clangFormat
}
}
l, err := acme.Log()
if err != nil {
Expand Down