Skip to content

Commit 71b81eb

Browse files
committed
Make index.md generated from canonical GopherJS README.
This way, having the website up to date becomes somewhat easier, until we have enough resources to manually maintain it with separate (curated) content.
1 parent a8a3d8a commit 71b81eb

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

doc.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Package gopherjswebsite is the www.gopherjs.org website source.
2+
//
3+
// It should be updated with `go generate github.com/gopherjs/gopherjs.github.io/...`.
4+
package gopherjswebsite
5+
6+
//go:generate go run generate.go

generate.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// +build generate
2+
3+
package main
4+
5+
import (
6+
"bytes"
7+
"io"
8+
"io/ioutil"
9+
"log"
10+
"net/http"
11+
)
12+
13+
func gen() error {
14+
resp, err := http.Get("https://raw.githubusercontent.com/gopherjs/gopherjs/master/README.md")
15+
if err != nil {
16+
return err
17+
}
18+
defer resp.Body.Close()
19+
body, err := ioutil.ReadAll(resp.Body)
20+
if err != nil {
21+
return err
22+
}
23+
24+
var buf bytes.Buffer
25+
io.WriteString(&buf, `---
26+
# generated by generate.go; DO NOT EDIT
27+
layout: index
28+
title: Home
29+
permalink: /
30+
---
31+
32+
`)
33+
_, err = buf.Write(body)
34+
if err != nil {
35+
return err
36+
}
37+
38+
ioutil.WriteFile("index.md", buf.Bytes(), 0644)
39+
40+
return nil
41+
}
42+
43+
func main() {
44+
err := gen()
45+
if err != nil {
46+
log.Fatalln(err)
47+
}
48+
}

index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
# generated by generate.go; DO NOT EDIT
23
layout: index
34
title: Home
45
permalink: /
@@ -7,6 +8,8 @@ permalink: /
78
GopherJS - A compiler from Go to JavaScript
89
-------------------------------------------
910

11+
[![Circle CI](https://circleci.com/gh/gopherjs/gopherjs.svg?style=svg)](https://circleci.com/gh/gopherjs/gopherjs)
12+
1013
GopherJS compiles Go code ([golang.org](http://golang.org/)) to pure JavaScript code. Its main purpose is to give you the opportunity to write front-end code in Go which will still run in all browsers. Give GopherJS a try on the [GopherJS Playground](http://gopherjs.github.io/playground/).
1114

1215
### What is supported?
@@ -31,6 +34,7 @@ Now you can use `gopherjs build [files]` or `gopherjs install [package]` which
3134
- Use `float64` instead of `float32`.
3235

3336
### Community
37+
- [#gopherjs Channel on Gophers Slack](https://gophers.slack.com/messages/gopherjs/) (invites to Gophers Slack are available [here](http://blog.gopheracademy.com/gophers-slack-community/#how-can-i-be-invited-to-join:2facdc921b2310f18cb851c36fa92369))
3438
- [Google Group](https://groups.google.com/d/forum/gopherjs)
3539
- [Bindings to JavaScript APIs and libraries](https://github.com/gopherjs/gopherjs/wiki/bindings)
3640
- [GopherJS on Twitter](https://twitter.com/GopherJS)

0 commit comments

Comments
 (0)