Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Coding Concepts

    Hi all, I've previously been using dlv for debugging but recently (perhaps since upgrading macos to Catalina?) I'm getting the following when attempting to debug applications or tests:

    # runtime/cgo
    ld: unknown option: -platform_version
    clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
    Process exiting with code: 1

    Has anyone else run into this issue and managed to fix it?

    6 replies
    Aaron Small
    hey folks, I'm stumped in figuring out where gopls gets its environment variables. this is causing a problem when running //go:generate and using a command relies on a plugin that needs to be in $PATH

    I've tried overriding them with

        "go.toolsEnvVars": {
            "PATH": "$HOME/go/bin:$PATH",

    but it doesn't seem to evaluate $PATH, so it overrides all existing

    Aaron Small
    oh, I figured it out. I launched vscode from a .desktop file. fixed when launching from a terminal with appropriate path set
    hi guys, how to fix this Version of Delve is too old for this version of Go
    mine is ver 1.14
    Collin K Cusce
    I been using vscode + Go for a while. Accidentally installed something called gopls and now all my code imports are showing errors
    how do I just undo whatever the heck I did, vscode prompted and I hit the wrong thing: full disclosure, I have no idea what gopls is and I dont code in Go much anymore, but I did for a stint last year
    Collin K Cusce
    I think I figured it out, I had to disable languageServer
    Hi. My main.go is under cmd subpackage under my project package. So far, I could not figure out how to configure launch.json. Is anyone able to configure launch.json to start debugging session with main.go not under project package level?
    I didn’t realize it was as easy as pointing to the file. This worked for me.
        // Use IntelliSense to learn about possible attributes.
        // Hover to view descriptions of existing attributes.
        // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
        "version": "0.2.0",
        "configurations": [
                "name": “Launch Your Go File",
                "type": "go",
                "request": "launch",
                "mode": "debug",
                "program": "${workspaceFolder}/cmd/main.go"

    Hi -- I'm trying to setup remote development on a remote Ubuntu server from my local MacBook, via vscode remote ssh. My remote Ubuntu server has go1.13 installed:

    $ go env
    CGO_CFLAGS="-g -O2"
    CGO_CXXFLAGS="-g -O2"
    CGO_FFLAGS="-g -O2"
    CGO_LDFLAGS="-g -O2"
    GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build061610720=/tmp/go-build -gno-record-gcc-switches"

    However, I can't seem to install vscode's Go extension onto my remote Ubuntu server. The Install on SSH: <ip> button doesn't appear on the extension when browsing my locally installed extensions.

    Rodrigo Alencar
    hi, how do I run go projects that are not modules and are cloned outside gopath on vscode?
    Is there an extension in vs code, so I can use it to edit "normal" text as well? I don't like the plane dark theme in google docs.
    does anyone know how to execute this built-in command?
    NobbZ Bogie (Gitter) yes.
    NobbZ Depending on your definition of "normal text".
    hello I am a newbie to Go, I am trying to jump to function definition in VS Code but VS code fails to go to the definition with error "No Definition found" but with in the same package its working fine can some one help me
    Craig McNiel

    Hi all - Struggling with my configuration and need some help. I'm trying to use environment variables in my current project to inject secure configuration data that I will use for running go tests that leverage network services.

    Every configuration I have tried fails to import/set the needed variables when I use "run test / debug test"

    Currently I have tried using
    "envFile" in my launch config to ${workspace}/.env "env": { "key": "value" } in launch config
    *Setting the "Go: Test Env File" to my .env file in the extension setting
    (This actually create an error when running "debug tests" Cannot load environment variables from file <path>/.env

    None of these seem to inject the needed variables into the environment so that I can us os.LookupEnv to retrieve them. Any clue what I'm doing wrong ? I'm on the latest version of VScode for Mac with current extensions.

    My current launch.json looks like below.

    Thanks in advance !

        // Use IntelliSense to learn about possible attributes.
        // Hover to view descriptions of existing attributes.
        // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
        "version": "0.2.0",
        "configurations": [{
            "name": "launch",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${workspaceFolder}",
            "env": {
                "LDAPUSER": "<redacted>",
                "LDAPPASS": ""<redacted>,
                "LDAPSERV": "<redacted>"
            "args": [""],
            "showLog": true
    @ramya-rao-a I encountered the same problem with microsoft/vscode-go#1421. The console log showed the following message: Error on CreateBreakpoint: could not find file /root/mr-weather-backend/pkg/widget/v1/service.go
    But I can find the file on the remote host.
    can someone please help me to setup golang on windows I have installed 4 different ide but still doesn't; work

    Hi, I have a problem with vscode + macbook m1 chip. Details here go-delve/delve#2332

    But "go.alternateTools": {"dlv": "path_to_your_wrapper_script"} not working ...

    Hi. is there someone who could help with blazor-webassembly-chrome-extension related issues
    i have built a chrome-extension using blazor-webassembly and it works fine on browserAction button. but my main goal is to inject my blazor-extension-UI into a webpage.
    Rahulkrishnan R A
    HI Guys, I have cloned a project but I could see that I cannot do GO TO DEFINITION for the exteranl dependencies , I have go all depedencies with $go mod download. Please advice how can I get definition of external packages which used as a dependencies
    1 reply
    Piyush Singariya

    Somehow the intellisense for the go extension in VSCode has stopped working for me? Not sure what has changed...

    What's the solution to this?

    1 reply
    How can I solve this problem

    "version" :"0.2.0"
    "configuration s":[
    "name":"(Windows) Launch";
    "program":"enter program name ,for example ${workspaceFolder}/a.exe";


    Please help 🥺
    How to solve which problem?
    I can't run visual studio at all
    when I click on its icon show those statement that I wrote at up
    and I don't know to pass this to enter app
    Visual studio or visual studio code?
    And can you provide a screenshot of what you click and happens then?
    I tried very hard to send the problem image in this chat but I do not know how it can be sent Can you help?
    This is my telegram id:@DNTPTHANKSGOD....Can you help me by telegram please?
    I send screenshot of problem by element app for you

    Sorry, I was already out of office when you wrote, and I didn't receive any pictures.

    If in doubt try Imgur or similar services

    Hello ,thanks ... it's solved . .l reinstalled another mingw and runner...then I could enter to app normally,however t
    hank you for your kindness .. I was encouraged..wherever you are, good luck
    sameer dean`
    Hi guys, when installing vscode-go extension and recommended extensions on vs-code docker container: using this: https://code.visualstudio.com/docs/remote/containers
    the container stalls and keeps restarting
    and it becomes a real struggle to keep it open with this extension and its recommended packages, gopls, delve etc.
    has anyone else faced this issue?
    Andrew Gopienko
    ui.diagnostic.analyses has the "printf" property and the description "The -funcs flag specifies a comma-separated list of names of additional known formatting functions or methods." I do not understand where I can specify this flag.
    Andrew Gopienko
    I want try to set -funсs to "Infof,Errorf" to check printf in external package

    I can debug simple program as mentioned in doc[1][2]. But now I have a problem. How do I debug an external library when running a project that make use of the library in vscode? Any tutorial? Thanks

    [1]. https://github.com/golang/vscode-go/blob/master/docs/debugging.md
    [2]. https://www.digitalocean.com/community/tutorials/debugging-go-code-with-visual-studio-code

    Shailesh Gavathe
    anyone know how to debug go operators with vscode for WSL2?
    I'm looking for more info on how the cover features work in the extension. I'd like to create a vscode task that runs a custom go test --coverpkg command, and then display the results like the extension does. Is that possible? I've found some extensions that attempt to do the same, but they don't look nearly as good.