Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

CoderPad/gofmt.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is the gofmt tool compiled via GopherJS into JavaScript. It's about a megabyte big, and works with Node and the browser (and probably require.js too). The interface is just one function:

var gofmt = require('gofmt.js');
console.log(gofmt("func main() {\nprintln() }"));
// prints:
// func main() {
//     println()
// }

If you include gofmt.js in the browser, the formatting function is exposed as window.gofmt. This function returns false if there was an error, and a string containing the formatted code otherwise.

As of this writing, this was compiled from Go 1.7.4's formatting code.

About

The `gofmt` tool cross-compiled to JavaScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published