Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

Add Golang to Languages and Frameworks #384

Merged
merged 16 commits into from
Jan 10, 2020
67 changes: 67 additions & 0 deletions src/docs/go_in_gitpod.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Go


Gitpod supports Go right out of the box, but there are still ways to optimize your Go experience within Gitpod.

## Examples
Before we start, here are some already gitpodified repositories to give you an idea of what to expect!
jankeromnes marked this conversation as resolved.
Show resolved Hide resolved

| Name | Open In Gitpod Button |
|---------|----------------------:|
| [go-swagger/go-swagger](https://github.com/go-swagger/go-swagger) | [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/go-swagger/go-swagger) |
| [gitpod-io/go-gin-app](https://github.com/gitpod-io/go-gin-app) | [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/gitpod-io/go-gin-app)
| [gosh-terminal/gosh](https://github.com/gosh-terminal/gosh) | [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/gosh-terminal/gosh)
| [gitpod-io/self-hosted](https://github.com/gitpod-io/self-hosted) | [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/gitpod-io/self-hosted)

## Workspace Configuration
### VSCode Extensions
| Name | Description |
|---------|----------------------|
| [Go Test Explorer](https://marketplace.visualstudio.com/items?itemName=premparihar.gotestexplorer) | Provides Test Explorer for Go which enables to run your tests at the click of a button! |
To add this to your Gitpod add the following to your [`.gitpod.yml`](https://www.gitpod.io/docs/41_config_gitpod_file/)
JesterOrNot marked this conversation as resolved.
Show resolved Hide resolved
```YAML
vscode:
extensions:
- [email protected]:jvUM8akrQ67vQxfjaxCgCg==
```
### Pre-builds
JesterOrNot marked this conversation as resolved.
Show resolved Hide resolved
Modern development is powered by OSS (Open Source Software) and as such external dependencies are a fact of life luckily in go it does not take long to gather these dependencies, so here is how to have them automatically fetched before you open your Gitpod workspace!
JesterOrNot marked this conversation as resolved.
Show resolved Hide resolved
```yaml
tasks:
- init: go get -v -t -d ./...
```
A full example of a [`.gitpod.yml`](https://www.gitpod.io/docs/41_config_gitpod_file/) file might look like this
```yaml
image: gitpod/workspace-full

tasks:
- init: go get -v -t -d ./...

vscode:
extensions:
- [email protected]:jvUM8akrQ67vQxfjaxCgCg==
jankeromnes marked this conversation as resolved.
Show resolved Hide resolved
```

### Using the `dep` dependency manager in Gitpod
If your project uses the [`dep`](https://golang.github.io/dep/) dependency manager then you need to add a [`.gitpod.Dockerfile`](https://www.gitpod.io/docs/42_config_docker/) to your project a basic example that extends the default workspace image might be something like
JesterOrNot marked this conversation as resolved.
Show resolved Hide resolved
```Dockerfile
FROM gitpod/workspace-full

USER gitpod

RUN brew install dep
```
Also, don't forget to reference the above Dockerfile in your `.gitpod.yml` configuration file, like so:
```yaml
image:
file: .gitpod.Dockerfile

tasks:
- init: dep ensure

vscode:
extensions:
- [email protected]:jvUM8akrQ67vQxfjaxCgCg==
```
## External Resources
* [VSCode/Go Documentation](https://code.visualstudio.com/docs/languages/go) The stuff here also applies to Gitpod!
1 change: 1 addition & 0 deletions src/docs/languages_and_frameworks.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Below is a list of language and framework specific tips & tricks.
* [Java](/docs/java_in_gitpod/)
* [Python](/docs/python_in_gitpod/)
* [Julia](/docs/julia_in_gitpod/)
* [Go](/docs/go_in_gitpod/)
4 changes: 4 additions & 0 deletions src/docs/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ export const MENU: MenuEntry[] = [
M(
"Julia",
"julia_in_gitpod"
),
M(
"Go",
"go_in_gitpod"
)
]
),
Expand Down