Closes #176. Add gofmt beautifier for Golang language
This commit is contained in:
parent
81fde0c9ea
commit
0a0ba673e8
|
@ -39,6 +39,8 @@ before_install:
|
|||
- brew install pandoc
|
||||
# Java, C, C++, C#, Objective-C, D, Pawn, Vala
|
||||
- brew install uncrustify
|
||||
# Golang
|
||||
- brew install go
|
||||
# PHP
|
||||
# - brew tap homebrew/homebrew-php
|
||||
# - brew gist-logs php56
|
||||
|
|
|
@ -44,6 +44,7 @@ Or Settings/Preferences ➔ Packages ➔ Search for `atom-beautify`
|
|||
- [x] [Ruby](https://github.com/donaldpipowitch/atom-beautify/issues/25)
|
||||
- Requires [Ruby Beautify](https://github.com/erniebrodeur/ruby-beautify)
|
||||
- [x] [CoffeeScript](https://github.com/donaldpipowitch/atom-beautify/issues/31)
|
||||
- [x] [Golang](https://github.com/Glavin001/atom-beautify/issues/176)
|
||||
- [x] [Java](https://github.com/Glavin001/atom-beautify/issues/45)
|
||||
- Requires [Uncrustify](http://sourceforge.net/projects/uncrustify/)
|
||||
- [x] [C](https://github.com/Glavin001/atom-beautify/issues/57)
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
// Why so much white space?
|
||||
|
||||
fmt.Println("This is a poorly formatted file!")
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
// Why so much white space?
|
||||
|
||||
|
||||
fmt.Println( "This is a poorly formatted file!" )
|
||||
}
|
|
@ -129,6 +129,8 @@
|
|||
"yaml",
|
||||
"front matter",
|
||||
"jekyll",
|
||||
"marko"
|
||||
"marko",
|
||||
"go",
|
||||
"golang"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -20,7 +20,8 @@ describe "BeautifyLanguages", ->
|
|||
"java", "javascript", "json", "less",
|
||||
"mustache", "objective-c", "perl", "php",
|
||||
"python", "ruby", "sass", "sql",
|
||||
"typescript", "xml", "csharp", "gfm", "marko", "tss"
|
||||
"typescript", "xml", "csharp", "gfm", "marko",
|
||||
"tss", "go"
|
||||
]
|
||||
|
||||
beforeEach ->
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
###
|
||||
Requires http://golang.org/cmd/gofmt/
|
||||
###
|
||||
|
||||
"use strict"
|
||||
Beautifier = require('./beautifier')
|
||||
|
||||
module.exports = class gofmt extends Beautifier
|
||||
name: "gofmt"
|
||||
|
||||
options: {
|
||||
Go: true
|
||||
}
|
||||
|
||||
beautify: (text, language, options) ->
|
||||
@run("gofmt", [
|
||||
@tempFile("input", text)
|
||||
])
|
|
@ -36,6 +36,7 @@ module.exports = class Beautifiers
|
|||
'coffee-formatter'
|
||||
'htmlbeautifier'
|
||||
'csscomb'
|
||||
'gofmt'
|
||||
'js-beautify'
|
||||
'perltidy'
|
||||
'php-cs-fixer'
|
||||
|
@ -332,12 +333,12 @@ module.exports = class Beautifiers
|
|||
userId: atom.config.get("atom-beautify._analyticsUserId")
|
||||
event: "Beautify"
|
||||
properties:
|
||||
language: language.name
|
||||
language: language?.name
|
||||
grammar: grammar
|
||||
extension: fileExtension
|
||||
version: version
|
||||
options: allOptions
|
||||
label: language.name
|
||||
label: language?.name
|
||||
category: version
|
||||
#
|
||||
if unsupportedGrammar
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
module.exports = {
|
||||
|
||||
name: "Go"
|
||||
description: "Golang"
|
||||
namespace: "go"
|
||||
|
||||
###
|
||||
Supported Grammars
|
||||
###
|
||||
grammars: [
|
||||
"Go"
|
||||
]
|
||||
|
||||
###
|
||||
Supported extensions
|
||||
###
|
||||
extensions: [
|
||||
"go"
|
||||
]
|
||||
|
||||
options: []
|
||||
|
||||
}
|
|
@ -28,6 +28,7 @@ module.exports = class Languages
|
|||
"d"
|
||||
"ejs"
|
||||
"erb"
|
||||
"go"
|
||||
"handlebars"
|
||||
"html"
|
||||
"java"
|
||||
|
|
Loading…
Reference in New Issue