golang.org/x/playground@v0.0.0-20230418134305-14ebe15bcd59/edit.html (about)

     1  <!doctype html>
     2  <html>
     3  	<head>
     4  		<title>The {{if .Gotip}}Gotip{{else}}Go{{end}} Playground</title>
     5  		<link rel="stylesheet" href="/static/style.css">
     6  		{{if .Analytics}}
     7  		<script async src="https://www.googletagmanager.com/gtag/js?id=UA-11222381-7"></script>
     8  		<script>
     9  			window.dataLayer = window.dataLayer || [];
    10  			function gtag(){dataLayer.push(arguments);}
    11  			gtag('js', new Date());
    12  			gtag('config', 'UA-11222381-7');
    13  			gtag('config', 'UA-49880327-6');
    14  		</script>
    15  		{{end}}
    16  		<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
    17  		<script src="/static/jquery-linedtextarea.js"></script>
    18  		<script src="/playground.js"></script>
    19  		<script src="/static/playground-embed.js"></script>
    20  		<script>
    21  		$(document).ready(function() {
    22  			playground({
    23  				'codeEl':       '#code',
    24  				'outputEl':     '#output',
    25  				'runEl':        '#run, #embedRun',
    26  				'fmtEl':        '#fmt',
    27  				'fmtImportEl':  '#imports',
    28  				{{if $.Share}}
    29  				'shareEl':      '#share',
    30  				'shareURLEl':   '#shareURL',
    31  				{{end}}
    32  				'enableHistory': true,
    33  				'enableShortcuts': true,
    34  				'enableVet': true,
    35  				'toysEl': '.js-playgroundToysEl'
    36  			});
    37  			playgroundEmbed({
    38  				'codeEl':       '#code',
    39  				{{if $.Share}}
    40  				'shareEl':      '#share',
    41  				{{end}}
    42  				'embedEl':      '#embed',
    43  				'embedLabelEl': '#embedLabel',
    44  				'embedHTMLEl':  '#shareURL'
    45  			});
    46  			$('#code').linedtextarea();
    47  			// Avoid line wrapping.
    48  			$('#code').attr('wrap', 'off');
    49  			var about = $('#about');
    50  			about.click(function(e) {
    51  				if ($(e.target).is('a')) {
    52  					return;
    53  				}
    54  				about.hide();
    55  			});
    56  			$('#aboutButton').click(function() {
    57  				if (about.is(':visible')) {
    58  					about.hide();
    59  					return;
    60  				}
    61  				about.show();
    62  			})
    63  			// Preserve "Imports" checkbox value between sessions.
    64  			if (readCookie('playgroundImports') == 'true') {
    65  				$('#imports').attr('checked','checked');
    66  			}
    67  			$('#imports').change(function() {
    68  				createCookie('playgroundImports', $(this).is(':checked') ? 'true' : '');
    69  			});
    70  			{{if .Analytics}}
    71  			// Fire Google Analytics events for Run/Share button clicks.
    72  			$('#run').click(function() {
    73  				gtag('event', 'click', {
    74  					event_category: 'playground',
    75  					event_label: 'run-button',
    76  				});
    77  			});
    78  			$('#share').click(function() {
    79  				gtag('event', 'click', {
    80  					event_category: 'playground',
    81  					event_label: 'share-button',
    82  				});
    83  			});
    84  			{{end}}
    85  		});
    86  
    87  		function createCookie(name, value) {
    88  			document.cookie = name+"="+value+"; path=/";
    89  		}
    90  
    91  		function readCookie(name) {
    92  			var nameEQ = name + "=";
    93  			var ca = document.cookie.split(';');
    94  			for(var i=0;i < ca.length;i++) {
    95  				var c = ca[i];
    96  				while (c.charAt(0)==' ') c = c.substring(1,c.length);
    97  				if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    98  			}
    99  			return null;
   100  		}
   101  		</script>
   102  	</head>
   103  	<body itemscope itemtype="http://schema.org/CreativeWork">
   104  		<input type="button" value="Run" id="embedRun">
   105  		<div id="banner">
   106  			<div id="head" itemprop="name">The {{if .Gotip}}<a href="https://golang.org/dl/gotip">Gotip</a>{{else}}Go{{end}} Playground</div>
   107  			<input type="button" value="Run" id="run">
   108  			<input type="button" value="Format" id="fmt">
   109  			<div id="importsBox">
   110  				<label title="Rewrite imports on Format">
   111  					<input type="checkbox" id="imports">
   112  					Imports
   113  				</label>
   114  			</div>
   115  			{{if $.Share}}
   116  			<input type="button" value="Share" id="share">
   117  			<input type="text" id="shareURL">
   118  			<label id="embedLabel">
   119  				<input type="checkbox" id="embed">
   120  				embed
   121  			</label>
   122  			{{end}}
   123  			<select class="js-playgroundToysEl">
   124  				{{range .Examples}}
   125  				<option value="{{.Path}}">{{.Title}}</option>
   126  				{{end}}
   127  			</select>
   128  			<input type="button" value="About" id="aboutButton">
   129  		</div>
   130  		<div id="wrap">
   131  			<textarea itemprop="description" id="code" name="code" autocorrect="off" autocomplete="off" autocapitalize="off" spellcheck="false">{{printf "%s" .Snippet.Body}}</textarea>
   132  		</div>
   133  		<div id="output"></div>
   134  		<img itemprop="image" src="/static/gopher.png" style="display:none">
   135  		<div id="about">
   136  <p><b>About the Playground</b></p>
   137  
   138  <p>
   139  The Go Playground is a web service that runs on
   140  <a href="https://golang.org/">golang.org</a>'s servers.
   141  The service receives a Go program, <a href="https://golang.org/cmd/vet/">vets</a>, compiles, links, and
   142  runs the program inside a sandbox, then returns the output.
   143  </p>
   144  
   145  <p>
   146  If the program contains <a href="https://golang.org/pkg/testing">tests or examples</a>
   147  and no main function, the service runs the tests.
   148  Benchmarks will likely not be supported since the program runs in a sandboxed
   149  environment with limited resources.
   150  </p>
   151  
   152  <p>
   153  There are limitations to the programs that can be run in the playground:
   154  </p>
   155  
   156  <ul>
   157  
   158  <li>
   159  The playground can use most of the standard library, with some exceptions.
   160  The only communication a playground program has to the outside world
   161  is by writing to standard output and standard error.
   162  </li>
   163  
   164  <li>
   165  In the playground the time begins at 2009-11-10 23:00:00 UTC
   166  (determining the significance of this date is an exercise for the reader).
   167  This makes it easier to cache programs by giving them deterministic output.
   168  </li>
   169  
   170  <li>
   171  There are also limits on execution time and on CPU and memory usage.
   172  </li>
   173  
   174  </ul>
   175  
   176  <p>
   177  The article "<a href="https://blog.golang.org/playground" target="_blank" rel="noopener">Inside
   178  the Go Playground</a>" describes how the playground is implemented.
   179  The source code is available at <a href="https://go.googlesource.com/playground" target="_blank" rel="noopener">
   180  https://go.googlesource.com/playground</a>.
   181  </p>
   182  
   183  <p>
   184  {{if .Gotip}}
   185  This playground uses a development version of Go.<br>
   186  {{else}}
   187  The playground uses the latest stable release of Go.<br>
   188  {{end}}
   189  The current version is <a href="/p/Ztyu2FJaajl">{{.GoVersion}}</a>.
   190  </p>
   191  
   192  <p>
   193  The playground service is used by more than just the official Go project
   194  (<a href="https://gobyexample.com/">Go by Example</a> is one other instance)
   195  and we are happy for you to use it on your own site.
   196  All we ask is that you
   197  <a href="mailto:golang-dev@googlegroups.com">contact us first (note this is a public mailing list)</a>,
   198  use a unique user agent in your requests (so we can identify you),
   199  and that your service is of benefit to the Go community.
   200  </p>
   201  
   202  <p>
   203  Any requests for content removal should be directed to
   204  <a href="mailto:security@golang.org">security@golang.org</a>.
   205  Please include the URL and the reason for the request.
   206  </p>
   207  		</div>
   208  	</body>
   209  </html>