From 8e814e260c352c08f92e91d5f9cac0691a601bc6 Mon Sep 17 00:00:00 2001 From: bamurtaugh Date: Fri, 5 Mar 2021 20:02:59 +0000 Subject: [PATCH 1/4] Add port attributes --- .devcontainer/devcontainer.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 11b6fb7..b83a17d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -19,7 +19,13 @@ "terminal.integrated.shell.linux": "/bin/bash", "go.useGoProxyToCheckForToolUpdates": false, "go.gopath": "/go", - "go.useLanguageServer": true + "go.useLanguageServer": true, + "remote.portsAttributes": { + "9000": { + "label": "My Port", + "onAutoForward": "notify" + } + } }, // Add the IDs of extensions you want installed when the container is created. From d16aa43991b895ac1f758d24334db587bc9cc204 Mon Sep 17 00:00:00 2001 From: bamurtaugh Date: Fri, 5 Mar 2021 20:03:55 +0000 Subject: [PATCH 2/4] Update go tools management --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b83a17d..fe50168 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -17,7 +17,7 @@ // Set *default* container specific settings.json values on container create. "settings": { "terminal.integrated.shell.linux": "/bin/bash", - "go.useGoProxyToCheckForToolUpdates": false, + "go.toolsManagement.checkForUpdates": "off", "go.gopath": "/go", "go.useLanguageServer": true, "remote.portsAttributes": { From 00a2984e100f2ea148a44d76f3441a10dae90bf0 Mon Sep 17 00:00:00 2001 From: bamurtaugh Date: Fri, 5 Mar 2021 20:18:22 +0000 Subject: [PATCH 3/4] Update readme about ports --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a37cc5c..f7c0df2 100644 --- a/README.md +++ b/README.md @@ -50,9 +50,12 @@ Some things to try: - Add a breakpoint (e.g. on line 22). - Press F5 to launch the app in the container. - Once the breakpoint is hit, try hovering over variables, examining locals, and more. - - Continue (F5). You can connect to the server in the container by either: clicking on `Running on http://0.0.0.0:9000/` in the terminal output, or "Open in Browser" next to port 9000 in the 'Ports' view (you can get to the 'Ports' view by clicking on the "1" in the status bar, which means your app has 1 forwarded port). + - Continue (F5). You can connect to the server in the container by either: + - Clicking on `Open in Browser` in the notification telling you: `Your service running on port 9000 is available`. + - Clicking the globe icon in the 'Ports' view. The 'Ports' view gives you an organized table of your forwarded ports, and you can get there by clicking on the "1" in the status bar, which means your app has 1 forwarded port. + - Notice port 9000 in the 'Ports' view is labeled "My Port." In `devcontainer.json`, you can set `"remote.portsAttributes"`, such as a label for your forwarded ports and the action to be taken when the port is autoforwarded. - > **Note:** In Remote - Containers, you can access your app at `http://localhost:9000` in a local browser. But in a browser-based Codespace, you must click the link from the terminal output or the `Ports` view so that the service handles port forwarding in the browser and generates the correct URL. + > **Note:** In Remote - Containers, you can access your app at `http://localhost:9000` in a local browser. But in a browser-based Codespace, you must click the link from the notification or the `Ports` view so that the service handles port forwarding in the browser and generates the correct URL. 4. **Rebuild or update your container:** (*Currently, only containers with the VS Code Remote - Containers extension can be rebuilt.*) From 3713acd258c6abb6914cd2876e983f3a305e028d Mon Sep 17 00:00:00 2001 From: bamurtaugh Date: Fri, 5 Mar 2021 20:20:47 +0000 Subject: [PATCH 4/4] Update rebuild info --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f7c0df2..db7d9cc 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ Some things to try: > **Note:** In Remote - Containers, you can access your app at `http://localhost:9000` in a local browser. But in a browser-based Codespace, you must click the link from the notification or the `Ports` view so that the service handles port forwarding in the browser and generates the correct URL. -4. **Rebuild or update your container:** (*Currently, only containers with the VS Code Remote - Containers extension can be rebuilt.*) +4. **Rebuild or update your container:** You may want to make changes to your container, such as installing a different version of a software or forwarding a new port. You'll rebuild your container for your changes to take effect. @@ -67,7 +67,7 @@ Some things to try: - Open the `.devcontainer/devcontainer.json` file. - Uncomment the `forwardedPorts` attribute and adjust the port number as needed. - - Press F1 and select the **Remote-Containers: Rebuild Container** command so the modifications are picked up. + - Press F1 and select the **Remote-Containers: Rebuild Container** or **Codespaces: Rebuild Container** command so the modifications are picked up. 5. **Refactoring - rename:** - Open `hello.go`, select method name `Hello` press F1 and run the **Rename Symbol** command. 6. **Refactoring - extract:**