I recently started looking into Vim/NeoVim as a lightweight fast IDE. I followed some tutorials and managed to set it up with nvim-tree, treesitter, telescope etc. (all the basic stuff) My Project opens fine with it, and I can use all the plugins I installed. It color codes my code files.
However when I execute :GoRun it prints { } (blank) environment variables from my .env file.
I wrote a small golang server that works fine when I execute it from vscode command line or just the terminal. I can use postman to make get and post requests and it returns valid json.
I am using the viper library to read the .env file.
I have searched through forums, asked chatgpt but I have not been able to find a solution to my problem. I changed paths from relative to absolute for the .env file, I copied the .env file to my project root directory. I tried using :source and :ch command in neovim but nothing seems to work.
=====================================================================
Here is the error it throws, remember this code works through command line but not through neovim
:!'go' 'run' '/home/user/Projects/project1/cmd/main.go' 2>&1| tee /tmp/nvim.user1/rI2p6E/7
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
- using env: export GIN_MODE=release
- using code: gin.SetMode(gin.ReleaseMode)
2023/04/16 16:41:25 sql: unknown driver "" (forgotten import?) exit status 1
I need help.