vscode

配置go开发环境

安装go vscode git

设置windows用户环境变量

GOROOT:golang安装目录
GOPATH:存放sdk以外的第三方类库、收藏可复用的代码
GOPATH目录约定有三个子目录:src、pkg、bin。src存放源代码(比如:.go .c .h .s等) 按照golang默认约定,go run,go install等命令的当前工作路径(即在此路径下执行上述命令);pkg编译时生成的中间文件(比如:.a)golang编译包时;bin编译后生成的可执行文件(为了方便,可以把此目录加入到PATH变量中,如果有多个gopath,那么使用{GOPATH/bin:}/bin添加所有的bin目录)

配置go env

# 打开git bash,键入以下命令
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct

vscode配置

# 安装扩展:go和code runner
# 键入ctrl+shift+p 搜:go:install/update
# 选择所有下拉框,点击确定开始安装
# vscode输出以下信息即完成
Tools environment: GOPATH=D:\Dev_Go\GoPath;D:\Dev_Go\workspace
Installing 7 tools at D:\Dev_Go\GoPath\bin;D:\Dev_Go\workspace\bin in module mode.
  gotests
  gomodifytags
  impl
  goplay
  dlv
  staticcheck
  gopls

Installing github.com/cweill/gotests/gotests@latest (D:\Dev_Go\GoPath\bin\gotests.exe) SUCCEEDED
Installing github.com/fatih/gomodifytags@latest (D:\Dev_Go\GoPath\bin\gomodifytags.exe) SUCCEEDED
Installing github.com/josharian/impl@latest (D:\Dev_Go\GoPath\bin\impl.exe) SUCCEEDED
Installing github.com/haya14busa/goplay/cmd/goplay@latest (D:\Dev_Go\GoPath\bin\goplay.exe) SUCCEEDED
Installing github.com/go-delve/delve/cmd/dlv@latest (D:\Dev_Go\GoPath\bin\dlv.exe) SUCCEEDED
Installing honnef.co/go/tools/cmd/staticcheck@latest (D:\Dev_Go\GoPath\bin\staticcheck.exe) SUCCEEDED
Installing golang.org/x/tools/gopls@latest (D:\Dev_Go\GoPath\bin\gopls.exe) SUCCEEDED

All tools successfully installed. You are ready to Go. :)

设置背景图

安装扩展

  • background
  • Fix VSCode Checksums

配置背景图

打开 vscode 文件>首选项>设置>扩展>Plugin background config.backgroud插件配置>Style>在settings.json中编辑

     // 背景设置配置 begin
     "background.enabled": true,  // 插件是否启动
     "background.useDefault": false,   // 是否使用默认图片
     "background.customImages": [  // 在这里添加自己喜欢图片的路径,最多可添加3张图片
        "file:///F:/backgroundImages/ny.jpg"
        // "file:///F:/backgroundImages/wlop.png",
        // "file:///F:/backgroundImages/小舞.jpg",
     ],
     "background.style": {
       "content": "''",
       "pointer-events": "none",
       "position": "absolute",
       "z-index": "99999",
       "width": "100%",
       "height": "100%",
       "background-position": "center",
       "background-repeat": "no-repeat",
       "background-size": "100%,100%",
       "opacity": 0.5  // 背景图片的透明度设置
     },
     "diffEditor.ignoreTrimWhitespace": false,
     "security.workspace.trust.untrustedFiles": "open",
     "explorer.confirmDelete": false
     // 背景设置配置 end

设置背景图后,Vscode标题栏出现【不受支持】提示的解决

ctrl + shift +p 输入以下命令,重启后就好了

Fix Checksums: Apply
posted @ 2022-05-18 17:24  MegaloBox  阅读(124)  评论(0编辑  收藏  举报