gofmt
/
0.2.0
gofmt 0.2.0
Install from the command line:
Learn more about npm packages
$ npm install @wasm-fmt/gofmt@0.2.0
Install via package.json:
"@wasm-fmt/gofmt": "0.2.0"
About this version
npm install @wasm-fmt/gofmt
import { format } from '@wasm-fmt/gofmt';
const source = `
package main
import "fmt"
func main(){fmt.Println("Hello, 世界")}
`;
const formatted = await format(source);
console.log(formatted);
Vite users tip:
import { format } from '@wasm-fmt/gofmt';
import wasmUrl from "@wasm-fmt/gofmt/lib.wasm?url";
// ...
const formatted = await format(source, new URL(wasmUrl, import.meta.url));
# 1. clone this repo
git clone https://github.com/wasm-fmt/gofmt.git
# 2. install TinyGo https://tinygo.org/getting-started/install/
# 3. build
npm run build
# 4. test
npm run test