Bruce Blog Bruce Blog
首页
  • CentOS
  • Ubuntu-Debian
  • 系统网络
  • 系统辅助工具
  • MySQL
  • Redis
  • Mongodb
  • Docker基础
  • Container基础
  • Kubernetes

    • Kubernetes基础
    • Kubernetes辅助
  • Container-Network
  • Jenkins
  • Gitlab
  • ArgoCD
  • Ansible
  • Terraform
  • AWS
  • MQ
  • NGINX
  • JumpServer
  • 基础
  • 函数模块
  • 框架
  • 基础

    • Golang环境
    • 语法
    • 数据类型与运算符
    • 分支语句
    • 循环语句
    • 数组
    • 切片
    • Map
    • String
    • 函数
    • 包的管理
    • 指针
    • 结构体
    • Go语言中的OOP
    • 方法和接口
    • 错误处理
  • Go进阶

    • Go进阶
  • Go框架

    • Go框架
  • Golang辅助

    • Golang辅助
  • CSS
  • HTML
  • JavaScript
  • 前端辅助
  • 常用命令
  • 性能监控工具
  • Windows下Docker使用
  • 日常学习
  • 其他导航

Bruce Tao

运维界的该溜子
首页
  • CentOS
  • Ubuntu-Debian
  • 系统网络
  • 系统辅助工具
  • MySQL
  • Redis
  • Mongodb
  • Docker基础
  • Container基础
  • Kubernetes

    • Kubernetes基础
    • Kubernetes辅助
  • Container-Network
  • Jenkins
  • Gitlab
  • ArgoCD
  • Ansible
  • Terraform
  • AWS
  • MQ
  • NGINX
  • JumpServer
  • 基础
  • 函数模块
  • 框架
  • 基础

    • Golang环境
    • 语法
    • 数据类型与运算符
    • 分支语句
    • 循环语句
    • 数组
    • 切片
    • Map
    • String
    • 函数
    • 包的管理
    • 指针
    • 结构体
    • Go语言中的OOP
    • 方法和接口
    • 错误处理
  • Go进阶

    • Go进阶
  • Go框架

    • Go框架
  • Golang辅助

    • Golang辅助
  • CSS
  • HTML
  • JavaScript
  • 前端辅助
  • 常用命令
  • 性能监控工具
  • Windows下Docker使用
  • 日常学习
  • 其他导航
  • 基础

  • Go进阶

  • Go框架

  • Golang辅助

    • Golang环境配置

    • GolangIDE

      • GolangIDE配置日常记录
      • VsCode中安装golang扩展
      • vscode golang插件安装(代码提示,跳转)
    • Golang
    • Golang辅助
    • GolangIDE
    Bruce
    2022-12-17
    目录

    vscode golang插件安装(代码提示,跳转)

    # 一、vscode golang插件安装(代码提示,跳转)

    go语言环境搭建:go语言环境搭建(linux) (opens new window)

    首先,需要安装好go插件,插件市场搜索go,选一个即可安装.

    然后,需要安装go的工具包.在vscode中,输入快捷键:command(ctrl) + shift + p,在弹出的窗口中,输入:go:install/Update Tools,回车后,选择所有插件(勾一下全选),点击确认,进行安装(设置GOPROXY).

    Installing 18 tools at /Users/liaojinlong/Workspace/CPChain/chain/bin
      gocode
      gopkgs
      go-outline
      go-symbols
      guru
      gorename
      dlv
      gocode-gomod
      godef
      goimports
      golint
      gopls
      gotests
      gomodifytags
      impl
      fillstruct
      goplay
      godoctor
    Installing github.com/mdempsky/gocode SUCCEEDED
    Installing github.com/uudashr/gopkgs/cmd/gopkgs SUCCEEDED
    Installing github.com/ramya-rao-a/go-outline SUCCEEDED
    Installing github.com/acroca/go-symbols SUCCEEDED
    Installing golang.org/x/tools/cmd/guru SUCCEEDED
    Installing golang.org/x/tools/cmd/gorename SUCCEEDED
    Installing github.com/go-delve/delve/cmd/dlv SUCCEEDED
    Installing github.com/stamblerre/gocode SUCCEEDED
    Installing github.com/rogpeppe/godef SUCCEEDED
    Installing golang.org/x/tools/cmd/goimports SUCCEEDED
    Installing golang.org/x/lint/golint SUCCEEDED
    Installing golang.org/x/tools/cmd/gopls SUCCEEDED
    Installing github.com/cweill/gotests/... SUCCEEDED
    Installing github.com/fatih/gomodifytags SUCCEEDED
    Installing github.com/josharian/impl SUCCEEDED
    Installing github.com/davidrjenni/reftools/cmd/fillstruct SUCCEEDED
    Installing github.com/haya14busa/goplay/cmd/goplay SUCCEEDED
    Installing github.com/godoctor/godoctor SUCCEEDED 
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    • 接下来,在项目的 settings.json 文件中添加配置
       "go.goroot": "D:\\Go",
        "go.gopath": "D:\\gopath",
        //第三方库代码提示
        "go.inferGopath": true,
        "go.formatTool": "goreturns",
        //自动完成未导入的包
        "go.autocompleteUnimportedPackages": true,
        "go.gocodePackageLookupMode": "go",
        "go.gotoSymbol.includeImports": true,
        "go.docsTool": "gogetdoc",
        "go.useCodeSnippetsOnFunctionSuggest": true,
        "go.useCodeSnippetsOnFunctionSuggestWithoutType": true,  
    
         "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, 
            },
        },"go.trace.server": "verbose", 
        "gopls": { 
            // Add parameter placeholders when completing a function. 
           "usePlaceholders": false, 
           // If true, enable additional analyses with staticcheck. 
           // Warning: This will significantly increase memory usage.   "staticcheck": false, 
        },"go.languageServerFlags": [ 
            "-remote=auto", "-logfile=auto", "-debug=:0", "-rpc.trace", 
        ], 
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34

    -windows配置git-bash终端

    "terminal.integrated.profiles.windows": {
        "PowerShell -NoProfile": {
          "source": "PowerShell",
          "args": [
            "-NoProfile"
          ]
        },
        "Git-Bash": {
          "path": "C:\\Program Files\\Git\\bin\\bash.exe",
          "args": []
        }
      },
    "terminal.integrated.defaultProfile.windows": "Git-Bash"
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    • 基础配置
    "editor.fontSize": 14,     
    // Fira Code字体好看  又发现字体也好看 Maple Mono
    "editor.fontFamily": "'Maple Mono','Fira Code Retina','Fira Code Medium', Consolas, 'Courier New', monospace",    
     "editor.fontLigatures": true,     
    // "workbench.iconTheme": "material-icon-theme",
    "workbench.iconTheme": "vscode-icons",     
    "workbench.colorTheme": "Monokai Pro",     
    "workbench.startupEditor": "none",     
    "window.zoomLevel": 1,     
    "files.autoSave": "afterDelay",     
    "git.autofetch": true,     
    "editor.lineHeight":24
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12

    # 二、完整的模板

    • Ctrl+Shift+p命令,输入setting,找到setting.json打开setting.json
    {
        "git.ignoreWindowsGit27Warning": true,
        "vsicons.dontShowNewVersionMessage": true,
    	//windows配置git-bash终端
        "terminal.integrated.profiles.windows": {
            "PowerShell-NoProfile": {
                "source": "PowerShell",
                "args": [-NoProfile]
            },
            "Git-Bash": {
                "path": "D:\\Git\\Git\\bin\\bash.exe",
                "args": []
            }
        },
        "terminal.integrated.defaultProfile.windows": "Git-Bash",
    	//基础配置
    	"editor.fontSize": 14,
    	// Fira Code字体好看又发现字体也好看 Maple Mono
    	"editor.fontFamily": "'Maple Mono','Fira Code Retina','Fira Code Medium', Consolas, 'Courier New', monospace",
    	"editor.fontLigatures": true,
    	// "workbench.iconTheme": "material-icon-theme",
    	"workbench.iconTheme": "vscode-icons",
    	//"workbench.colorTheme": "Monokai",
    	//"workbench.colorTheme": "Atom One Dark",
    	"workbench.colorTheme": "Monokai Pro",
    	"workbench.startupEditor": "none",
    	//"window.zoomLevel": -1,
        //"window.zoomLevel": 0,
    	"window.zoomLevel": 1,
    	"files.autoSave": "afterDelay",
    	"git.autofetch": true,
    	"editor.lineHeight":24,
        "remote.SSH.remotePlatform": {
            "alias": "linux",
            "Remote_Linux": "linux",
            "you-get": "linux",
            "Remote-Python": "linux",
            "Remote-Envoy": "linux",
            "Local-Linux-Coding": "linux",
            "Local-Kubeadm": "linux",
            "Win10-Local": "windows",
            "Blog-system": "linux",
            "golang": "linux",
            "Terraform": "linux",
            "DTerraform": "linux",
            "gin-vue-admin": "linux",
            "ak-golang": "linux",
            "devops-go": "linux",
            "devops-go-local": "linux",
            "argocd-server": "linux",
            "Ubuntu22-kuberentes-devops": "linux"
        },
        "git.ignoreLegacyWarning": true,
        "[json]": {
            "editor.quickSuggestions": {
                "strings": true
            },
            "editor.suggest.insertMode": "replace"
        },
        "go.gopath": "E:\\Github-Project\\GO-Project",
        "go.goroot": "D:\\Golang\\go1.18.8",
        "go.useCodeSnippetsOnFunctionSuggest": true,
        "go.useCodeSnippetsOnFunctionSuggestWithoutType": true,
        "go.useLanguageServer": true,
        //第三方代码库提示
        "go.inferGopath": true,
        "go.formatTool": "goreturns",
        "go.gotoSymbol.includeImports": true,
        "go.docsTool": "gogetdoc",
        "go.gocodePackageLookupMode": "go",
        //自动完成未导入的包
        "go.autocompleteUnimportedPackages": 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,
            },
        },
        "go.trace.server": "verbose",
        "gopls": {
            // Add parameter placeholders when completing a function.
            "usePlaceholders": false,
            // If true, enable additional analyses with staticcheck.
            // Warning: This will significantly increase memory usage.   "staticcheck": false,
        },
        "go.languageServerFlags": [
            "-remote=auto", "-logfile=auto", "-debug=:0", "-rpc.trace",
        ],
        "explorer.confirmDragAndDrop": false,
        "editor.suggest.snippetsPreventQuickSuggestions": false,
        "view-in-browser.customBrowser": "chrome",
        "[html]": {
            "breadcrumbs.showArrays": true,
            "editor.suggest.insertMode": "replace",
            "editor.defaultFormatter": "HookyQR.beautify"
        },
        "editor.linkedEditing": true,
        "git.ignoreMissingGitWarning": true,
        "explorer.confirmDelete": false,
        "files.autoSaveDelay": 0,
        "update.enableWindowsBackgroundUpdates": true,
        "background.customImages": [
            "file:///E:\\电脑壁纸\\hehua.jpg"
        ],
        "background.style": {
            "content": "''",
            "pointer-events": "none",
            "position": "absolute",
            "width": "100%",
            "height": "100%",
            "z-index": "99999",
            "background.repeat": "no-repeat",
            "background-size": "110%,110%",
            "opacity": 0.2
        },
        "background.useFront": true,
        "background.useDefault": false,
        "liveServer.settings.donotShowInfoMsg": true,
        "editor.quickSuggestions": {
            "strings": true
        },
        "[javascript]": {
            "editor.defaultFormatter": "vscode.typescript-language-features"
        },
        "winopacity.opacity": 240,
        "terminal.integrated.automationShell.windows": "",
        "editor.suggestSelection": "first",
        "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
        "redhat.telemetry.enabled": true,
        "terminal.integrated.inheritEnv": false,
        "bracketPairColorizer.depreciation-notice": false,
        "workbench.settings.openDefaultSettings": true,
        // "files.associations": {
        //     "*.py": "security"
        // },
        "files.associations": {
            "*.html": "html",
            "*.tpl": "html",
            "*.nj": "html",
            "*.vue": "html",
            "*.py": "python",
            "*.go": "go"
        },
        "liveServer.settings.donotVerifyTags": true,
        "python.formatting.provider": "yapf",
        "[python]": {
            "editor.defaultFormatter": "ms-python.python"
        },
        "files.exclude": {
            "**/.classpath": true,
            "**/.project": true,
            "**/.settings": true,
            "**/.factorypath": true
        },
        "terminal.integrated.enableMultiLinePasteWarning": false,
        "[yaml]": {
            "editor.defaultFormatter": "redhat.vscode-yaml"
        },
        "eslint.codeActionsOnSave.rules": [],
        "[go]": {
            "editor.formatOnType": false
        },
        "sqltools.connections": [],
        "terminal.integrated.autoReplies": {},
        "terminal.integrated.automationProfile.windows": {},
        // "files.defaultLanguage": "python"
        "eslint.workingDirectories": [
            ".eslintrc.js",
            {
                "mode": "auto"
            }
        ],
        "editor.unicodeHighlight.allowedCharacters": {
            " ": true
        },
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    上次更新: 2024/04/09, 16:48:42
    VsCode中安装golang扩展

    ← VsCode中安装golang扩展

    最近更新
    01
    AWS NAT-NetWork-Firwalld配置(一)
    04-09
    02
    AWS NAT-NetWork-Firwalld配置(二)
    04-09
    03
    kubernetes部署minio对象存储
    01-18
    更多文章>
    Theme by Vdoing | Copyright © 2019-2024 Bruce Tao Blog Space | MIT License
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式