Skip to content

Commit 0c1d4ed

Browse files
committed
skeleton
1 parent 79c49c9 commit 0c1d4ed

File tree

4 files changed

+99
-2
lines changed

4 files changed

+99
-2
lines changed

.devcontainer/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM ubuntu:18.04
2+
3+
COPY . .
4+
5+
ENV PATH "$PATH:/usr/local/go/bin:/home/user/go/bin:/home/user/.cargo/bin"
6+
RUN cd .devcontainer && bash setup.sh
7+
USER user

.devcontainer/devcontainer.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "Codespaces Go Template Repository",
3+
"extensions": [
4+
"coenraads.bracket-pair-colorizer-2",
5+
"eamodio.gitlens",
6+
"github.vscode-pull-request-github",
7+
"ms-azuretools.vscode-docker",
8+
"ms-vsliveshare.vsliveshare",
9+
"vscode-icons-team.vscode-icons",
10+
"visualstudioexptteam.vscodeintellicode",
11+
"ms-vscode.go"
12+
],
13+
"dockerFile": "Dockerfile",
14+
"settings": {
15+
"terminal.integrated.shell.linux": "/usr/bin/zsh"
16+
}
17+
}

.devcontainer/setup.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# install curl, git, ...
2+
apt-get update
3+
apt-get install -y curl git jq
4+
5+
useradd -m user
6+
su user
7+
8+
# install go
9+
VERSION='1.14'
10+
OS='linux'
11+
ARCH='amd64'
12+
13+
curl -OL https://dl.google.com/go/go${VERSION}.${OS}-${ARCH}.tar.gz
14+
tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
15+
rm go$VERSION.$OS-$ARCH.tar.gz
16+
17+
INSTALLED_GO_VERSION=$(go version)
18+
echo "Go version ${INSTALLED_GO_VERSION} is installed"
19+
20+
# install gopls, dlv, hey
21+
echo "Getting development tools"
22+
go get -u golang.org/x/tools/gopls
23+
go get -u github.com/go-delve/delve/cmd/dlv
24+
go get -u github.com/rakyll/hey
25+
26+
# vscode-go dependencies
27+
echo "Getting dependencies for the vscode-go plugin "
28+
# via: https://github.com/microsoft/vscode-go/blob/master/.travis.yml
29+
go get -u -v github.com/acroca/go-symbols
30+
go get -u -v github.com/cweill/gotests/...
31+
go get -u -v github.com/davidrjenni/reftools/cmd/fillstruct
32+
go get -u -v github.com/haya14busa/goplay/cmd/goplay
33+
go get -u -v github.com/mdempsky/gocode
34+
go get -u -v github.com/ramya-rao-a/go-outline
35+
go get -u -v github.com/rogpeppe/godef
36+
go get -u -v github.com/sqs/goreturns
37+
go get -u -v github.com/uudashr/gopkgs/cmd/gopkgs
38+
go get -u -v github.com/zmb3/gogetdoc
39+
go get -u -v golang.org/x/lint/golint
40+
go get -u -v golang.org/x/tools/cmd/gorename

README.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,35 @@
1-
# go
2-
Go (Golang) Codespaces Template Repo
1+
# Go (Golang) Codespaces starter template
2+
3+
Welcome, Gopher! This repository is a template for you to use in your next (or existing) Go project so you can take advantage of [Visual Studio Codespaces](https://visualstudio.microsoft.com/services/visual-studio-codespaces/), or the brand-new [GitHub Codespaces](https://github.com/features/codespaces).
4+
5+
## How to get started on a new repository
6+
7+
The easiest way to get started is on a new repository. For that, simply click on the green "Use this template" button, right above the list of files.
8+
9+
After you do, a list of options for creating a _new_ repository will pop up. After you're done, a brand new repository will be created for you, wherever you told it to. And it'll be pre-populated with everything you need to be up and running with Codespaces.
10+
11+
## How to get started with an existing repository
12+
13+
TODO
14+
15+
## Testing this out
16+
17+
This template sets up Go entirely inside a Docker image. To test it, make sure you have [Docker](https://docker.com) installed and run the below command from the root of this repository:
18+
19+
```console
20+
$ docker build -f ./.devcontainer/Dockerfile .
21+
```
22+
23+
>When you run the command, make sure to remove the leading `$`
24+
25+
## Built on the Shoulders of Giants
26+
27+
Like almost every developer who contributes to open source, I didn't write this code in a vacuum. I had help! Thank you to the following contributors for helping me build this:
28+
29+
- [`bnb`](https://github.com/bnb) for code from [codespaces-examples/node](https://github.com/codespaces-examples/node
30+
)
31+
- [`asw101`](https://github.com/asw101) for code from [`asw101/hello-vso`](https://github.com/asw101/hello-vso)
32+
33+
I took inspiration, and sometimes code, from their repositories.
34+
35+
>I took code and ideas _directly_ from these developers' repositories. There are countless other projects and technologies that this repository implicitly relies on, and the list of contributors behind those projects is too long to write here. Thank you to every one of those contributors.

0 commit comments

Comments
 (0)