From 97f9cc87968a2e5a39e8f4fe2009147c73c1a0c7 Mon Sep 17 00:00:00 2001 From: todd wells Date: Fri, 9 Aug 2019 16:42:31 -0700 Subject: [PATCH 1/2] Add Readme for VS Code remote --- .devcontainer/Dockerfile | 17 +++++++++++++++++ .devcontainer/devcontainer.json | 23 +++++++++++++++++++++++ Makefile | 26 ++++++++++++++++++++++++++ README.md | 11 ++++++++++- 4 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..83fd273 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,17 @@ +#------------------------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. +#------------------------------------------------------------------------------------------------------------- + +FROM circleci/golang:1.11 +ENV GO111MODULE=on + +# Avoid warnings by switching to noninteractive +ENV DEBIAN_FRONTEND=noninteractive + +# Or your actual UID, GID on Linux if not the default 1000 +ARG USERNAME=circleci +ARG USER_UID=3434 +ARG USER_GID=$USER_UID + + diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..7eb9e1d --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,23 @@ +{ + "name": "Go", + "dockerFile": "Dockerfile", + "appPort": 9000, + "extensions": [ + "ms-vscode.go" + ], + "runArgs": [ + // Comment out the next line to run as root instead. Linux users, + // update Dockerfile with your user's UID/GID if not 1000. + "-u", + "circleci", + "--cap-add=SYS_PTRACE", + "--security-opt", + "seccomp=unconfined" + ], + "settings": { + "go.gopath": "/go", + "go.inferGopath": true, + "go.useLanguageServer": true + }, + "postCreateCommand": "echo 'make vscoderemotedev'; make vscoderemotedev" +} diff --git a/Makefile b/Makefile index 30cf239..477d8fd 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,30 @@ CLI_FILES = $(shell find cli linter assertion -name \*.go) default: all +devdeps: + @echo "=== dev dependencies ===" + @go get "github.com/gobuffalo/packr/..." + @go get -u golang.org/x/lint/golint + @go get "github.com/fzipp/gocyclo" + +vscoderemotedeps: + @echo "=== vscode remote dev dependencies ===" + # Install gocode-gomod + @go get -x -d github.com/stamblerre/gocode 2>&1 \ + && go build -o gocode-gomod github.com/stamblerre/gocode \ + && mv gocode-gomod $$GOPATH/bin/ \ + && go get -u -v \ + github.com/mdempsky/gocode \ + github.com/uudashr/gopkgs/cmd/gopkgs \ + github.com/ramya-rao-a/go-outline \ + github.com/acroca/go-symbols \ + golang.org/x/tools/cmd/gopls \ + golang.org/x/tools/cmd/guru \ + golang.org/x/tools/cmd/gorename \ + github.com/go-delve/delve/cmd/dlv \ + golang.org/x/tools/cmd/goimports \ + github.com/rogpeppe/godef 2>&1 + deps: @echo "=== dependencies ===" go mod download @@ -51,6 +75,8 @@ $(BUILD_DIR)/config-lint: $(CLI_FILES) build: gen $(BUILD_DIR)/config-lint all: clean deps test build +dev: deps devdeps +vscoderemotedev: deps devdeps vscoderemotedeps clean: @echo "=== cleaning ===" diff --git a/README.md b/README.md index 4ca6168..deab708 100644 --- a/README.md +++ b/README.md @@ -163,7 +163,16 @@ The files will *not* be scanned for violations. The overall design in described [here](docs/design.md). -# Development +# VS Code Remote Development +The preferred method of developing is to use the VS Code Remote development functionality. + +- Install the VS Code [Remote Development extension pack](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack) +- Open the repo in VS Code +- When prompted "`Folder contains a dev container configuration file. Reopen folder to develop in a container`" click the "`Reopen in Container`" button +- When opening in the future use the "`config-lint [Dev Container]`" option + + +# Local Development ## Prerequisites - [Install golang](https://golang.org/doc/install) From 7f0158977fa6bf0745642cd9d4f501f4980a9425 Mon Sep 17 00:00:00 2001 From: Keith Monihen Date: Thu, 15 Aug 2019 16:27:33 -0400 Subject: [PATCH 2/2] clarifying comment to dockerfile --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 7eb9e1d..ed94c80 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,7 +6,7 @@ "ms-vscode.go" ], "runArgs": [ - // Comment out the next line to run as root instead. Linux users, + // Comment out the next two lines to run as root instead. Linux users, // update Dockerfile with your user's UID/GID if not 1000. "-u", "circleci",