gofmtr
v0.0.2
Published
`gofmtr` is a simple npm package that exports a single function for formatting Go code. It's a lightweight, pure-JavaScript implementation of the `gofmt` command, and it can be used in any JavaScript environment.
Downloads
3
Readme
gofmtr
gofmtr is a simple npm package that exports a single function for formatting Go code. It's a lightweight, pure-JavaScript implementation of the gofmt command, and it can be used in any JavaScript environment.
Installation
To install gofmtr, simply run the following command:
npm install gofmtrUsage
To use gofmtr, import the gofmt function from the package and pass it a string containing Go code. The function will return a new string with the formatted code:
import { gofmt } from 'gofmtr';
const code = `
package main
import "fmt"
func main() {
fmt.Println("Hello, world!")
}
`;
console.log(gofmt(code));License
gofmtr is released under the MIT license. See LICENSE for more details.
