项目作者: rhysd

项目描述 :
(a bit) relaxed gofmt
高级语言: Go
项目地址: git://github.com/rhysd/gofmtrlx.git
创建时间: 2017-02-04T13:16:39Z
项目社区:https://github.com/rhysd/gofmtrlx

开源协议:BSD 3-Clause "New" or "Revised" License

下载


gofmtrlx: Relaxed gofmt

This is a fork of gofmt.

This project is being rebased continuously on original gofmt (as long as I’m using gofmtrlx).

What is a problem?

gofmt can’t format a code which contains syntax error. For example,

  1. package main
  2. func main() {
  3. s := []int{
  4. 1,
  5. 2,
  6. 3
  7. }
  8. }

This code can’t be formatted because there is no trailing comma at line 6.

How did gofmtrlx solve the problem?

Actually, Go’s parser can parse this without bad AST node. So gofmt can format the code with fixing syntax error.

gofmtrlx ignores syntax error if there is no bad node in AST. In above code, gofmtrlx can fill up trailing comma
on formatting it.

Installation and usage

  1. go get -u github.com/rhysd/gofmtrlx

Usage is the same as gofmt command.

License

All codes are licensed the same license as original gofmt.