Skip to content

wasm-fmt/gofmt

Folders and files

NameName
Last commit message
Last commit date
Nov 25, 2024
Sep 2, 2023
Mar 13, 2024
Aug 11, 2023
Jan 18, 2024
Sep 2, 2023
Nov 16, 2023
Jan 18, 2024
Sep 2, 2023
Sep 2, 2023
Mar 13, 2024
Dec 3, 2024
Mar 13, 2024
Aug 6, 2023
Aug 4, 2023
Apr 15, 2024
Aug 26, 2023
Nov 22, 2024
Jan 18, 2024
Nov 22, 2024
Jan 18, 2024
Jan 18, 2024
Nov 25, 2024

Repository files navigation

Test

Install

npm

npm install @wasm-fmt/gofmt

jsr.io

npx jsr add @fmt/gofmt

Usage

import init, { format } from "@wasm-fmt/gofmt";

await init();

const source = `
package main
import "fmt"
func main(){fmt.Println("Hello, 世界")
}
`;

const formatted = format(source);
console.log(formatted);

Vite users tip:

import init, { format } from "@wasm-fmt/gofmt/vite";

Build from source

# 1. clone this repo
git clone https://github.com/wasm-fmt/gofmt.git

# 2. install TinyGo https://tinygo.org/getting-started/install/

# 3. build
pnpm build

# 4. test
pnpm run /^test:/