Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lemonnekogh/gofmt.js
https://github.com/lemonnekogh/gofmt.js
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/lemonnekogh/gofmt.js
- Owner: LemonNekoGH
- License: mit
- Created: 2024-08-06T11:36:19.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-07T11:40:44.000Z (5 months ago)
- Last Synced: 2024-10-26T22:52:58.468Z (about 2 months ago)
- Language: JavaScript
- Size: 347 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gofmt.js
A gofmt tool compiled by GopherJS.## Get started
Install by npm:
```shell
npm install @lemonneko/gofmt.js
```
If you use commonjs:
```javascript
const gofmt = require('@lemonneko/gofmt.js')console.log(gofmt.format(`type Person struct {
Name string \`json:"name"\`
Age int \`json:"age"\`
}`))
```
If you use esm:
```javascript
import gofmt from '@lemonneko/gofmt.js'console.log(gofmt.format(`type Person struct {
Name string \`json:"name"\`
Age int \`json:"age"\`
}`))
```
The result should be:
```javascript
[
'type Person struct {\n' +
'\tName string `json:"name"`\n' +
'\tAge int `json:"age"`\n' +
'}',
''
]
```