https://github.com/rhysd/gofmtrlx
(a bit) relaxed gofmt
https://github.com/rhysd/gofmtrlx
formatter golang
Last synced: over 1 year ago
JSON representation
(a bit) relaxed gofmt
- Host: GitHub
- URL: https://github.com/rhysd/gofmtrlx
- Owner: rhysd
- License: bsd-3-clause
- Created: 2017-02-04T13:16:39.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-15T02:34:12.000Z (over 8 years ago)
- Last Synced: 2025-03-29T00:33:48.117Z (over 1 year ago)
- Topics: formatter, golang
- Language: Go
- Homepage: https://github.com/golang/go/issues/18939
- Size: 35.2 KB
- Stars: 23
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
gofmtrlx: Relaxed gofmt
=======================
This is a fork of [gofmt](https://golang.org/cmd/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,
```go
package main
func main() {
s := []int{
1,
2,
3
}
}
```
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
```
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.