Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
go开源项目镜像
Vscode Remote Try Go
提交
86b970f3
V
Vscode Remote Try Go
项目概览
go开源项目镜像
/
Vscode Remote Try Go
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
Vscode Remote Try Go
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
86b970f3
编写于
7月 28, 2020
作者:
U
uta-mori
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Go Modules migration
上级
21c0264f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
58 addition
and
53 deletion
+58
-53
.devcontainer/Dockerfile
.devcontainer/Dockerfile
+7
-23
.devcontainer/devcontainer.json
.devcontainer/devcontainer.json
+47
-26
.vscode/launch.json
.vscode/launch.json
+2
-2
.vscode/settings.json
.vscode/settings.json
+2
-2
未找到文件。
.devcontainer/Dockerfile
浏览文件 @
86b970f3
# Update the VARIANT arg in devcontainer.json to pick an Go version
ARG
VARIANT=1
ARG
VARIANT=1
.14
FROM
golang:${VARIANT}
# This Dockerfile adds a non-root user with sudo access. Update the “remoteUser” property in
...
...
@@ -27,17 +27,17 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*
# Install Go tools
ENV
GO111MODULE=on
ARG
GO_TOOLS_WITH_MODULES="\
golang.org/x/tools/gopls \
honnef.co/go/tools/... \
golang.org/x/tools/cmd/gorename \
golang.org/x/tools/cmd/goimports \
golang.org/x/tools/cmd/guru \
golang.org/x/lint/golint \
github.com/mdempsky/gocode \
github.com/cweill/gotests/... \
github.com/haya14busa/goplay/cmd/goplay \
github.com/sqs/goreturns \
github.com/josharian/impl \
github.com/davidrjenni/reftools/cmd/fillstruct \
github.com/uudashr/gopkgs/v2/cmd/gopkgs \
...
...
@@ -49,29 +49,13 @@ ARG GO_TOOLS_WITH_MODULES="\
github.com/fatih/gomodifytags \
github.com/mgechev/revive \
github.com/go-delve/delve/cmd/dlv"
RUN
mkdir
-p
/tmp/gotools
\
&&
cd
/tmp/gotools
\
&&
export
GOPATH
=
/tmp/gotools
\
# Go tools w/module support
&& export GO111MODULE=on \
&& (echo "${GO_TOOLS_WITH_MODULES}" | xargs -n 1 go get -x )2>&1 \
# gocode-gomod
&& export GO111MODULE=auto \
&& go get -x -d github.com/stamblerre/gocode 2>&1 \
&& go build -o gocode-gomod github.com/stamblerre/gocode \
RUN
(
echo
"
${
GO_TOOLS_WITH_MODULES
}
"
| xargs
-n
1 go get
)
2>&1
\
# golangci-lint
&& curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin 2>&1 \
# Move Go tools into path and clean up
&& mv /tmp/gotools/bin/* /usr/local/bin/ \
&& mv gocode-gomod /usr/local/bin/ \
&& rm -rf /tmp/gotools
ENV
GO111MODULE=auto
# [Optional] Uncomment the next line to use go get to install anything else you need
# RUN go get -x <your-dependency-or-tool>
# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update \
# && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
\ No newline at end of file
# && apt-get -y install --no-install-recommends <your-package-list-here>
.devcontainer/devcontainer.json
浏览文件 @
86b970f3
{
"name"
:
"Go"
,
"build"
:
{
"dockerfile"
:
"Dockerfile"
,
//
Update
the
VARIANT
arg
to
pick
a
version
of
Go
"args"
:
{
"VARIANT"
:
"1
"
}
},
"runArgs"
:
[
"--cap-add=SYS_PTRACE"
,
"--security-opt"
,
"seccomp=unconfined"
],
"name"
:
"Go"
,
"build"
:
{
"dockerfile"
:
"Dockerfile"
,
//
Update
the
VARIANT
arg
to
pick
a
version
of
Go
"args"
:
{
"VARIANT"
:
"1.14
"
}
},
"runArgs"
:
[
"--cap-add=SYS_PTRACE"
,
"--security-opt"
,
"seccomp=unconfined"
],
//
Set
*default*
container
specific
settings.json
values
on
container
create.
"settings"
:
{
"terminal.integrated.shell.linux"
:
"/bin/bash"
,
"go.gopath"
:
"/go"
,
"go.inferGopath"
:
true
,
"go.useLanguageServer"
:
true
},
//
Add
the
IDs
of
extensions
you
want
installed
when
the
container
is
created.
"extensions"
:
[
"golang.Go"
],
//
Set
*default*
container
specific
settings.json
values
on
container
create.
"settings"
:
{
"terminal.integrated.shell.linux"
:
"/bin/bash"
,
"go.useLanguageServer"
:
true
,
"[go]"
:
{
"editor.formatOnSave"
:
true
,
"editor.codeActionsOnSave"
:
{
"source.organizeImports"
:
true
},
//
Optional:
Disable
snippets
,
as
they
conflict
with
completion
ranking.
"editor.snippetSuggestions"
:
"none"
},
"[go.mod]"
:
{
"editor.formatOnSave"
:
true
,
"editor.codeActionsOnSave"
:
{
"source.organizeImports"
:
true
}
},
"gopls"
:
{
//
Add
parameter
placeholders
when
completing
a
function.
"usePlaceholders"
:
true
,
//
the
completion
engine
is
allowed
to
make
suggestions
for
packages
that
you
do
not
currently
import.
"completeUnimported"
:
true
,
//
Use
'forwardPorts'
to
make
a
list
of
ports
inside
the
container
available
locally.
"forwardPorts"
:
[
9000
],
//
If
true
,
enable
additional
analyses
with
staticcheck.
//
Warning:
This
will
significantly
increase
memory
usage.
"staticcheck"
:
true
},
"go.lintTool"
:
"golangci-lint"
},
//
Use
'postCreateCommand'
to
run
commands
after
the
container
is
created.
//
"postCreateCommand"
:
"go version"
,
//
Add
the
IDs
of
extensions
you
want
installed
when
the
container
is
created.
"extensions"
:
[
"golang.Go"
]
,
//
Uncomment
to
connect
as
a
non-root
user.
See
https://aka.ms/vscode-remote/containers/non-root.
"remoteUser"
:
"vscode"
}
\ No newline at end of file
//
Use
'forwardPorts'
to
make
a
list
of
ports
inside
the
container
available
locally.
"forwardPorts"
:
[
9000
],
//
Use
'postCreateCommand'
to
run
commands
after
the
container
is
created.
//
"postCreateCommand"
:
"go version"
,
//
Uncomment
to
connect
as
a
non-root
user.
See
https://aka.ms/vscode-remote/containers/non-root.
"remoteUser"
:
"vscode"
}
.vscode/launch.json
浏览文件 @
86b970f3
...
...
@@ -6,7 +6,7 @@
"type"
:
"go"
,
"request"
:
"launch"
,
"mode"
:
"debug"
,
"program"
:
"${workspaceFolder}/s
rc/main/s
erver.go"
"program"
:
"${workspaceFolder}/server.go"
}
]
}
\ No newline at end of file
}
.vscode/settings.json
浏览文件 @
86b970f3
{
"go.useLanguageServer"
:
true
,
"go.inferGopath"
:
true
}
\ No newline at end of file
"go.inferGopath"
:
false
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录