diff --git a/.gitignore b/.gitignore index db7fffea52..452910ba48 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,6 @@ Thumbs.db vendor/ *.db -.vscode/ # ignore default binary name generated with Makefile golang-echo-realworld-example-app diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000000..c8353399be --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,7 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "golang.go" + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000000..0ed35d1fd6 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + "version": "0.2.0", + "configurations": [ + { + "name": "Debug current file", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "${fileDirname}" + } + ] +} diff --git a/devfile.yaml b/devfile.yaml new file mode 100644 index 0000000000..7a495766ae --- /dev/null +++ b/devfile.yaml @@ -0,0 +1,67 @@ +schemaVersion: 2.1.0 +metadata: + name: golang-echo-example +attributes: + che-theia.eclipse.org/sidecar-policy: USE_DEV_CONTAINER +components: + - name: go-cli + container: + image: quay.io/devfile/universal-developer-image:ubi8-112f94a + env: + - name: GOPATH + value: /projects:/home/user/go + - name: GOCACHE + value: /tmp/.cache + endpoints: + - name: 8080-tcp + targetPort: 8585 + memoryLimit: 2Gi + mountSources: true +commands: + - id: dependencies + exec: + label: "2.1 xenisa :: install dependencies" + component: go-cli + workingDir: ${PROJECTS_ROOT}/golang-echo-example + commandLine: "go mod download" + group: + kind: build + - id: run + exec: + label: "2.2 xenisa :: run" + component: go-cli + workingDir: ${PROJECTS_ROOT}/golang-echo-example + commandLine: "go run main.go" + group: + kind: run + - id: build + exec: + label: "2.3 xenisa :: build" + component: go-cli + workingDir: ${PROJECTS_ROOT}/golang-echo-example + commandLine: "go build" + group: + kind: build + - id: test + exec: + label: "2.4 xenisa :: test" + component: go-cli + workingDir: ${PROJECTS_ROOT}/golang-echo-example + commandLine: "go test ./..." + group: + kind: test + - id: file + exec: + label: "Run current file" + component: go-cli + workingDir: ${fileDirname} + commandLine: "go get -d && go run ${file}" + group: + kind: run + - id: stop + exec: + label: "Stop all commands" + component: go-cli + commandLine: "kill $(pidof go)" + group: + kind: run