GithubHelp home page GithubHelp logo

Comments (7)

ray-x avatar ray-x commented on August 15, 2024

I guess that in windows, you need to use GoRun .\\cmd ?
You need to set the path the same as you did when you run it with go run in windows cmd.

from go.nvim.

fithurriague avatar fithurriague commented on August 15, 2024

Just tried that, same response :(
I also found out that it doesn't detect any modules. Because I thought, it should at least work inside cmd folder, but when I GoRun there, it literally does nothing. So I tried GoDebug, but the log says it doesn't detect any of the non-standard imported modules so it fails.
(Btw in the terminal I run the code with go run .)
Nevermind, the GoRun works inside the cmd folder, it just takes way too long. GoDebug in the other hand still fails.

from go.nvim.

ray-x avatar ray-x commented on August 15, 2024

I think the issue is more regarding windows vs linux/Mac have different path name format
.projectRoot/cmd/main.go does not seem to be a valid path in windows.

For debug . you may have same issue. As in dap.lua, the code says

    dap_cfg.program = "./${relativeFileDirname}"

I doubt it is valid in windows....

from go.nvim.

fithurriague avatar fithurriague commented on August 15, 2024

Okey, I have reduced the problem to the minimum creating a new golang project ./go which file structure is:
main.go
go.mod
go.sum
pkg/sum.go

This show me a couple things, firts of all GoRun/GoDebug works only if you enter neovim inside the project folder, otherwise it doesn't matter if you run GoRun or GoRun ./go or whatever it always throw an error.
Once you open neovim inside ./go folder, GoRun works well and what remains is GoDebug.
Another thing I figured out it's that for the plugin to work you must have a global main.go with its respective go.mod and go.sum. If you have your main file and stuff inside, let's say cmd folder, again , no matter what command you run it always fails saying that it doesn't detect any of the imported modules (local or external).
¿Any ideas on how to fix / work around this? :)

from go.nvim.

ray-x avatar ray-x commented on August 15, 2024

In your windows command line, with old project structure, does any of this work

cmd> go run .projectRoot/cmd/main.go
cmd> go run .projectRoot/cmd/...
cmd> go run .projectRoot\\cmd\\...
cmd> go run .projectRoot\\cmd\\main.go

from go.nvim.

fithurriague avatar fithurriague commented on August 15, 2024

Yes, go run ./cmd works perfect. And also find out what was making GoRun ./cmd not work.
The only thing that still doesn't work is GoDebug. But you already helped so much and I think that it has more to do with nvim-dap or nvim-dap-go that what it has to do with this plugin.
Thank u for the patience! :)
You can close the issue if you feel like

from go.nvim.

ray-x avatar ray-x commented on August 15, 2024

link to dap issue:
mfussenegger/nvim-dap#346

from go.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.