/golang-devspace

DevSpace for Golang development

Primary LanguageDockerfile

DevSpace for Go environment.

  • Go v1.12.1

Getting Started

  1. First install DevSpaces client application, follow the instructions here to do this.

  2. Clone this repository locally

  3. To create a DevSpace, open a terminal then navigate to the cloned repository directory and run following command

devspaces create

This will open a build status window and shows you the progress of DevSpace creation. Once build is successful validated starts.

  1. Once validation is completed. Run devspaces ls command to see the list of DevSpaces and corresponding status. Newly created DevSpace golang will be in "Stopped" status.

  2. To start your DevSpace run following command

devspaces start golang

You will receive a notification when your DevSpace is ready to be used.

  1. To get inside your DevSpace, run following command
devspaces exec golang

Run Demo fasthttp Application

  1. From a new terminal, clone the demo application repository
git clone https://github.com/valyala/fasthttp.git
  1. Navigate to cloned demo application directory
cd fasthttp
  1. To synchronization code from your local machine to your DevSpace. Run following command
devspaces bind golang

This will synchronize files from your current working directory to your DevSpace. It might takes some time to complete, depending on the repository size.

  1. Get inside your DevSpace by running following command
devspaces exec golang
  1. Once you're inside DevSpace, you should be able see fasthttp project files under /data directory.

  2. Build application

go get -t -v ./...
go build ./...
  1. Run Tests
go test -v ./...
  1. Run application.
cd  examples/fileserver
go build fileserver.go
./fileserver -addr=0.0.0.0:80 -dir=./

Now application is running. To get the public URL exposed by DevSpace, run following command from your local terminal devspaces info golang. Command will output http URL which you can open in your browser to access the application.