Skip to content

Commit

Permalink
Add Go notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
sualeh committed May 6, 2024
1 parent 72408c2 commit 516fb55
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions Notebooks/3_go_unicode_numbers.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,62 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"----------\n",
"\n",
"# Google Colab\n",
"\n",
"You can run this notebook in Google Colab. The cell below should be run only once, and then followed by a change of runtime to `Go (gonb)`. Ignore any loading errors. Refresh the browser before running any subsequent code. If you are not running the notebook in Google Colab, skip this section."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#@title Prepare Google Colab for Go Kernel\n",
"\n",
"# Install Go and goimports.\n",
"!echo -n \"Installing go ...\"\n",
"!mkdir -p cache\n",
"!wget -q -O cache/go.tar.gz 'https://go.dev/dl/go1.22.2.linux-amd64.tar.gz'\n",
"!tar xzf cache/go.tar.gz\n",
"%env GOROOT=/content/go\n",
"!ln -sf \"/content/go/bin/go\" /usr/bin/go\n",
"!echo \" done.\"\n",
"!go version\n",
"\n",
"# Install gonb, goimports, gopls.\n",
"!echo -n \"Installing gonb ...\"\n",
"!go install github.com/janpfeifer/gonb@latest >& /tmp/output || cat /tmp/output\n",
"!echo \" done.\"\n",
"!ln -sf /root/go/bin/gonb /usr/bin/gonb\n",
"\n",
"!echo -n \"Installing goimports ...\"\n",
"!go install golang.org/x/tools/cmd/goimports@latest >& /tmp/output || cat /tmp/output\n",
"!echo \" done.\"\n",
"!ln -sf /root/go/bin/goimports /usr/bin/goimports\n",
"\n",
"!echo -n \"Installing gopls ...\"\n",
"!go install golang.org/x/tools/gopls@latest >& /tmp/output || cat /tmp/output\n",
"!echo \" done.\"\n",
"!ln -sf /root/go/bin/gopls /usr/bin/gopls\n",
"\n",
"# Install gonb kernel configuration.\n",
"!gonb --install --logtostderr\n",
"!echo \"Done!\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"----------"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down

0 comments on commit 516fb55

Please sign in to comment.