Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Add realworld go sample #96

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions devfiles/go-web-sample/devfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
apiVersion: 1.0.0
metadata:
generateName: golang-realworld-app-
projects:
-
name: example
source:
type: git
location: https://github.com/xesina/golang-echo-realworld-example-app
clonePath: golang-realworld-app
components:
-
type: chePlugin
id: ms-vscode/go/latest
alias: go-plugin
memoryLimit: 512Mi
preferences:
go.formatTool: goimports
go.useLanguageServer: true
-
type: dockerimage
image: quay.io/eclipse/che-golang-1.12:nightly
alias: go-cli
env:
- name: GOPATH
# replicate the GOPATH from the plugin
value: /go:$(CHE_PROJECTS_ROOT)
- name: GOCACHE
# replicate the GOCACHE from the plugin, even though the cache is not shared
# between the two
value: /tmp/.cache
- name: GO111MODULE
value: on
tolusha marked this conversation as resolved.
Show resolved Hide resolved
memoryLimit: 512Mi
mountSources: true
commands:
-
name: install dependencies
actions:
- type: exec
component: go-cli
command: go mod download
workdir: ${CHE_PROJECTS_ROOT}/golang-realworld-app
-
name: run
actions:
- type: exec
component: go-cli
command: go run main.go
workdir: ${CHE_PROJECTS_ROOT}/golang-realworld-app
-
name: build
actions:
- type: exec
component: go-cli
command: go build
tolusha marked this conversation as resolved.
Show resolved Hide resolved
workdir: ${CHE_PROJECTS_ROOT}/golang-realworld-app
-
name: test
actions:
- type: exec
component: go-cli
command: go test ./...
workdir: ${CHE_PROJECTS_ROOT}/golang-realworld-app
-
name: user create
actions:
- type: exec
component: go-cli
command: "curl --header \"Content-Type: application/json\" --request POST --data '{\"user\": {\"Username\":\"user\", \"Email\":\"user@user.user\", \"Password\": \"password\"}}' localhost:8585/api/users"
-
name: user login
actions:
- type: exec
component: go-cli
command: "curl --header \"Content-Type: application/json\" --request POST --data '{\"user\": {\"Email\":\"user@user.user\", \"Password\": \"password\"}}' localhost:8585/api/users/login"
-
name: Debug current file
actions:
- type: vscode-launch
referenceContent: |
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug current file",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}",
},
]
}
6 changes: 6 additions & 0 deletions devfiles/go-web-sample/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
displayName: Go Real World Application
description: Go Stack with Go 1.12 and Real World Application
tags: ["Debian", "Go"]
icon: https://www.eclipse.org/che/images/logo-eclipseche.svg
globalMemoryLimit: 1686Mi