blob: 8e69eea998b1996dd10db5eea0f334d6f52514e1 [file] [log] [blame]
Andrew Gerrand8bbe5cc2012-01-20 07:37:36 +11001<!--{
2 "Path": "/"
3}-->
4
Andrew Gerrandd1e726c2012-03-05 10:34:22 +11005<div class="left">
Andrew Gerrandd84de092012-02-13 21:22:36 +11006
7<div id="learn">
Francisco Souza170301d2012-03-13 12:57:48 +11008<img class="icon share" src="/doc/share.png" alt="View full screen" title="View full screen">
Andrew Gerrandd84de092012-02-13 21:22:36 +11009<div class="rootHeading">Try Go</div>
10<div class="input">
Andrew Gerrande8636a62012-03-13 11:00:11 +110011<textarea spellcheck="false" class="code">// You can edit this code!
Andrew Gerrandd84de092012-02-13 21:22:36 +110012// Click here and start typing.
13package main
14
15import "fmt"
16
17func main() {
18 fmt.Println("Hello, 世界")
19}</textarea>
20</div>
Andrew Gerrande8636a62012-03-13 11:00:11 +110021<div class="output">
Andrew Gerrandd84de092012-02-13 21:22:36 +110022<pre>
23Hello, 世界
24</pre>
25</div>
26<div class="buttons">
Andrew Gerrandd528f522012-03-15 17:44:47 +110027<a class="run" href="#" title="Run this code [shift-enter]">Run</a>
28<a class="share" href="#" title="Share this code">Share</a>
29<a class="tour" href="http://tour.golang.org/" title="Learn Go from your browser">Tour</a>
30</div>
31<div class="toys">
32<select>
33 <option value="hello.go">Hello, World!</option>
Andrew Gerrand850d1022013-06-04 12:59:28 +100034 <option value="life.go">Conway's Game of Life</option>
Andrew Gerrandd528f522012-03-15 17:44:47 +110035 <option value="fib.go">Fibonacci Closure</option>
36 <option value="peano.go">Peano Integers</option>
37 <option value="pi.go">Concurrent pi</option>
38 <option value="sieve.go">Concurrent Prime Sieve</option>
39 <option value="solitaire.go">Peg Solitaire Solver</option>
40 <option value="tree.go">Tree Comparison</option>
41</select>
Andrew Gerrandd84de092012-02-13 21:22:36 +110042</div>
43</div>
44
45</div>
46
Andrew Gerrandd1e726c2012-03-05 10:34:22 +110047<div class="right">
48
49<div id="about">
50Go is an open source programming environment that makes it easy to build
51simple, reliable, and efficient software.
52</div>
53
54<div id="gopher"></div>
55
Andrew Gerrand80cb47b2012-03-05 17:07:10 +110056<a href="/doc/install" id="start">
Andrew Gerrand17d12d62013-03-01 11:22:13 +110057<span class="big">Download Go</span>
58<span class="desc">
Andrew Gerrandd1e726c2012-03-05 10:34:22 +110059Binary distributions available for<br>
60Linux, Mac OS X, Windows, and more.
Andrew Gerrand17d12d62013-03-01 11:22:13 +110061</span>
Andrew Gerrandd1e726c2012-03-05 10:34:22 +110062</a>
63
64</div>
65
Andrew Gerrandd84de092012-02-13 21:22:36 +110066<div style="clear: both"></div>
67
Andrew Gerrandd1e726c2012-03-05 10:34:22 +110068<div class="left">
Andrew Gerrandd84de092012-02-13 21:22:36 +110069
70<div id="video">
71<div class="rootHeading">Featured video</div>
Andrew Gerranddd6db9b2012-06-22 10:22:01 -070072<iframe width="415" height="241" src="http://www.youtube.com/embed/ytEkHepK08c" frameborder="0" allowfullscreen></iframe>
Andrew Gerrandd84de092012-02-13 21:22:36 +110073</div>
74
75</div>
76
Andrew Gerrandd1e726c2012-03-05 10:34:22 +110077<div class="right">
Andrew Gerrandd84de092012-02-13 21:22:36 +110078
79<div id="blog">
80<div class="rootHeading">Featured articles</div>
81<div class="read"><a href="http://blog.golang.org/">Read more</a></div>
82</div>
83
84</div>
85
86<div style="clear: both;"></div>
87
Andrew Gerrand35096872012-02-15 12:59:50 +110088<script type="text/javascript">
Andrew Gerrandf0c3d262013-05-08 09:23:50 -070089
90function readableTime(t) {
91 var m = ["January", "February", "March", "April", "May", "June", "July",
92 "August", "September", "October", "November", "December"];
93 var p = t.substring(0, t.indexOf("T")).split("-");
94 var d = new Date(p[0], p[1]-1, p[2]);
95 return d.getDate() + " " + m[d.getMonth()] + " " + d.getFullYear();
96}
Andrew Gerrand7190fdd2010-03-20 11:42:57 +110097
Andrew Gerrandd84de092012-02-13 21:22:36 +110098function feedLoaded(result) {
Andrew Gerrand35096872012-02-15 12:59:50 +110099 var blog = document.getElementById("blog");
100 var read = blog.getElementsByClassName("read")[0];
Andrew Gerrandf0c3d262013-05-08 09:23:50 -0700101 for (var i = 0; i < result.length && i < 2; i++) {
102 var entry = result[i];
Andrew Gerrand35096872012-02-15 12:59:50 +1100103 var title = document.createElement("a");
104 title.className = "title";
Andrew Gerrandf0c3d262013-05-08 09:23:50 -0700105 title.href = entry.Link;
106 title.innerHTML = entry.Title;
Andrew Gerrand35096872012-02-15 12:59:50 +1100107 blog.insertBefore(title, read);
108 var extract = document.createElement("div");
109 extract.className = "extract";
Andrew Gerrandf0c3d262013-05-08 09:23:50 -0700110 extract.innerHTML = entry.Summary;
Andrew Gerrand35096872012-02-15 12:59:50 +1100111 blog.insertBefore(extract, read);
112 var when = document.createElement("div");
113 when.className = "when";
Andrew Gerrandf0c3d262013-05-08 09:23:50 -0700114 when.innerHTML = "Published " + readableTime(entry.Time);
Andrew Gerrand35096872012-02-15 12:59:50 +1100115 blog.insertBefore(when, read);
116 }
Andrew Gerrandd84de092012-02-13 21:22:36 +1100117}
118
Andrew Gerrandd920d8d2013-07-30 14:22:14 +1000119window.initFuncs.push(function() {
Andrew Gerranda48702e2013-08-22 11:12:44 +1000120 // Set up playground if enabled.
121 if (window.playground) {
122 window.playground({
123 "codeEl": "#learn .code",
124 "outputEl": "#learn .output",
125 "runEl": "#learn .run",
126 "shareEl": "#learn .share",
127 "shareRedirect": "http://play.golang.org/p/",
128 "toysEl": "#learn .toys select"
129 });
130 } else {
131 $('#learn').hide()
132 }
Andrew Gerrandd84de092012-02-13 21:22:36 +1100133
Andrew Gerrandf0c3d262013-05-08 09:23:50 -0700134 // Load blog feed.
135 $('<script/>').attr('text', 'text/javascript')
136 .attr('src', 'http://blog.golang.org/.json?jsonp=feedLoaded')
137 .appendTo('body');
138});
139
Andrew Gerrandd84de092012-02-13 21:22:36 +1100140</script>