VScode for Golang - How to setup Visual Studio Code for Go [2020]

  Рет қаралды 69,461

John McBride

John McBride

Күн бұрын

Пікірлер: 104
@JohnCodes
@JohnCodes 2 жыл бұрын
NEW UPDATED VERSION OF THIS VIDEO FOR 2022!!!!! ---->> kzbin.info/www/bejne/pqfJdoaJdseVqtU
@JohnCodes
@JohnCodes 3 жыл бұрын
Hey all - VScode as of ~Feburary 2021 now enables the gopls server by default and much of the documentation has now moved into the upstream "golang" github org. So this video is a bit out of date. But, there are still some useful tidbits around enabling debugging, some of the settings, etc. Checkout the official repo for more documentation: github.com/golang/vscode-go
@nagendrapatel7404
@nagendrapatel7404 3 ай бұрын
Nice and detailed one. Very helpful.
@billionairepodcast
@billionairepodcast 3 жыл бұрын
VScode golang extension JSON configuration on gitub is missing. Not on the website anymore
@JohnCodes
@JohnCodes 3 жыл бұрын
Right - alot's changed since I made this. Many of the settings have moved out of the "beta" state. Check out the official github for configuration settings: github.com/golang/vscode-go
@GolangDojo
@GolangDojo 3 жыл бұрын
I'm reading the doc - it says "VS Code Go extension now enables the gopls language server by default", and it seems we no longer need to do anything!
@hedobeagamer2340
@hedobeagamer2340 3 жыл бұрын
That must explain why the page for the JSON settings doesn't exist anymore in the repo
@JohnCodes
@JohnCodes 3 жыл бұрын
Excatly!! Alot's changed since I made this. Check the official github for configurations: github.com/golang/vscode-go
@khazaryahu
@khazaryahu 4 жыл бұрын
Thanks man this was really useful for setting up vs code for Go.
@JohnCodes
@JohnCodes 4 жыл бұрын
Glad it helped!
@evinwoon6809
@evinwoon6809 2 жыл бұрын
Hey John! Im having problems with inputting in Go on VS code so i thought i didnt set up properly. I can input something, but after i do, i get this error noDebug mode: unable to process 'evaluate' request. Im kinda stuck at 4:24, for one thing, the link you provided doesnt exist anymore, and when i try to manually input the settings in the settings.json tab, it just doesnt work. Please help! Loving your content so far!
@amrutnikam5643
@amrutnikam5643 2 жыл бұрын
I already have visual studio .... So can I directly install the extention for go and run code or Else I have to install first go ? Pl tell..
@eltirad0
@eltirad0 2 жыл бұрын
do you know how to work with microsrvices in golang? what I want to do is open a workspace folder with all my microservices and start working in a simple instance in VS Code instead of having a new VS Code instance for each microservice, I am able to open the workspace but it shows a lot of errors in each .go file in the import sections, I think I need to configure something about go modules (go.mod) in every microservice but I don't know what :(
@sameeralikhan5133
@sameeralikhan5133 Жыл бұрын
whenever i try to update or install gopls extension vs code always gives me the following error could not import debug/elf (EOF)
@manofqwerty
@manofqwerty 2 жыл бұрын
Does this still need to be done in the current year?
@milkyway9225
@milkyway9225 3 жыл бұрын
what a cute chipmunk. the one with glasses. dude took Gopher impersonation too seriously
@JohnCodes
@JohnCodes 3 жыл бұрын
it meee
@rumpeldrump
@rumpeldrump 2 жыл бұрын
why not use the build-in terminal?
@pietergleixner3994
@pietergleixner3994 2 жыл бұрын
For 2022, install the extension as said and almost everything comes by default. But if you run a hello world it will appear an error like " go.mod file not found in current directory or any parent directory; see 'go help modules' " you fix it in the terminal with the command "go env -w GO111MODULE=off" and thigs should work fine. As for testing, you need to create the launch.json first, the promt as shown in the video doesn't show again. After creating that file that should be automatic then you can run the test as in the video.
@mikecon4097
@mikecon4097 2 жыл бұрын
Hi Pieter, can you pls share your launch.json setting file, for me, it's not working, saving files is taking years, the entire system is getting slow on saving, and also your settings.json for go Thank you
@pietergleixner3994
@pietergleixner3994 2 жыл бұрын
@@mikecon4097 Hi, first, I made a major mistake, DO NOT use the command "go env -w GO111MODULE=off" it will ruin future projects. Every project start with "go init mod " the setting JSON file should be auto-generated. Start your project on the main.go (or the main file of your project) with F5 for debugging. If you don't do that it will launch an error to configure the JSON file I mention, you don't want that.
@_waysmall_
@_waysmall_ 2 жыл бұрын
This helped me in 2022. 😁😁
@kunafeh
@kunafeh 4 жыл бұрын
super helpful! wish you channel grows fast. Here's a sub.
@JohnCodes
@JohnCodes 4 жыл бұрын
Thank you very much!! Appreciate it
@Ankit-df8rw
@Ankit-df8rw 2 жыл бұрын
I installed the same theme...but not able to get the same appearances...can anyone help one plz?
@AnubhavLatiyan
@AnubhavLatiyan Жыл бұрын
bro is there any offline installer for go tools?
@MrTornnado
@MrTornnado 4 жыл бұрын
Thank you! My golang intellisense was sooo slow, but you have fixed it
@JohnCodes
@JohnCodes 4 жыл бұрын
Awesome!! Glad this was useful!!
@philip9489
@philip9489 3 жыл бұрын
The Link for "VScode golang extension JSON configuration" is outdated/ unavailable
@JohnCodes
@JohnCodes 3 жыл бұрын
Yeah, alot has changed since I made this video. For one, the gopls server is no longer in "beta" so alot of the settings have also changed. Check out the official github for configurations: github.com/golang/vscode-go
@महात्मा-गांधी-असली-वाले
@महात्मा-गांधी-असली-वाले 3 жыл бұрын
sidhi bat no bakawas its mean say straight forward point to point thank bro
@dylankawalec3517
@dylankawalec3517 3 жыл бұрын
I'm getting an error saying " Failed to launch: could not launch process: can not run under Rosetta, check that the installed build of Go is right for your CPU architecture... where it wants me to launch.json ; what do I do? Mac m1 mini with rosetta
@JohnCodes
@JohnCodes 3 жыл бұрын
Sounds like you might have the wrong version of Go for your M1 mac. I'm not sure if Go is supported on the new ARM architecture macs.
@paverschlev98
@paverschlev98 3 жыл бұрын
Just want to ask is it possible to input when I use vscode debugmod on vscode?
@JohnCodes
@JohnCodes 3 жыл бұрын
Hmmmm I'm not sure - I doubt it
@JohnCodes
@JohnCodes 4 жыл бұрын
Hey all! Thanks for watching! Hope you enjoy using vscode with golang - let me know what you want to see covered next with Golang!!
@khazaryahu
@khazaryahu 4 жыл бұрын
Hi John, I have seen in some websites that Golang is the language of the cloud, Can you do your next video about "how to get started in cloud computing domain using Golang 🤔"
@JohnCodes
@JohnCodes 4 жыл бұрын
Great idea! I'll see what I can do!
@exit-zero
@exit-zero 4 жыл бұрын
Great job mate
@JohnCodes
@JohnCodes 4 жыл бұрын
Thanks much!
@jianlu9841
@jianlu9841 3 жыл бұрын
I was trying to install those extensions and it said "cannot install go tools. set either go.gopath or go.toolsgopath in settings."
@JohnCodes
@JohnCodes 3 жыл бұрын
You'll need your go path set. This _should_ get set automatically when you install go on your system. Make sure you have go setup and installed correctly.
@carlosazurmendi6918
@carlosazurmendi6918 3 жыл бұрын
my go.mod file doesn't have a red go icon
@JohnCodes
@JohnCodes 3 жыл бұрын
Hmmmm you might need to get a different icon plugin - there are lots and lots!
@kayax01
@kayax01 4 жыл бұрын
And what about the workspace? This is the first thing I'm asked from studio... You don't even mention it aut you're presenting a code before defining a workspace?
@JohnCodes
@JohnCodes 4 жыл бұрын
Good question! With Visual Studio code, you can open any directory or folder without having to define a workspace. And for Go, you can open some ".go" files and get started without having to get a workspace up and running!
@जैराधाकृष्ण
@जैराधाकृष्ण 3 жыл бұрын
Thanks a lot as short video covering debugging
@JohnCodes
@JohnCodes 3 жыл бұрын
You are most welcome!!!
@CikaVuksan
@CikaVuksan 3 жыл бұрын
How to setup auto run when I save changes?
@JohnCodes
@JohnCodes 3 жыл бұрын
There's a setting for that. You want the "go.buildOnSave" setting
@SarveshBhatnagar1214
@SarveshBhatnagar1214 3 жыл бұрын
vscode settings link not found. That needs to be upgraded but great video overall.
@stanislavdimitrenko
@stanislavdimitrenko 3 жыл бұрын
I think you don't need it now. I work without it settings.
@JohnCodes
@JohnCodes 3 жыл бұрын
Yes, VScode has moved around some of their repositories. The gopls beta is now more integrated into the plugin. Try this link: github.com/golang/vscode-go
@damo190
@damo190 4 жыл бұрын
Hi John, I was thinking to learn NodeJs as I am a frontend React developer. Now I am thinking to get hands-on experience with golang instead of NodeJs. My system has i3 2nd gen processor with 6gb RAM and no external graphics card support. Can I start learning with this laptop? And I want to watch your new video series on golang. I am new to it.
@JohnCodes
@JohnCodes 4 жыл бұрын
That laptop should be fine :) but might be a little slow. If you upgraded to an i5, that would be more than enough. Give it a try and see how it works!!
@cal1686
@cal1686 4 жыл бұрын
gopls doesn't work for me. I get couldn't find import when using vscode for module.
@JohnCodes
@JohnCodes 4 жыл бұрын
Hmmmm - interesting, might be worth opening an issue with the vscode go tools. Again, gopls is still in beta so it could be rough around the edges.
@cal1686
@cal1686 4 жыл бұрын
@@JohnCodes Yeah, good idea. I noticed that I only had the problem when I was using vscode workspaces. It's fine if you just open a folder. Although, I don't know how to confirm it's using gopls vs. the built in.
@kunafeh
@kunafeh 3 жыл бұрын
May I know what software you use to make these videos? Like simultaneous capturing of your screen and video. It's pretty neat!
@JohnCodes
@JohnCodes 3 жыл бұрын
Thanks! OBS is what I use
@sm5172
@sm5172 3 жыл бұрын
Very useful, thank you. You have great presentation skills.
@JohnCodes
@JohnCodes 3 жыл бұрын
Thank you! Appreciate that
@abraaocarvalho4505
@abraaocarvalho4505 4 жыл бұрын
What is the theme of your vscode ? Is beautiful.
@JohnCodes
@JohnCodes 4 жыл бұрын
I believe this is one of the "One Dark" themes. I also frequently bounce around the various "Monokai" themes. It's nice since they are so easy to install and switch between
@parthjoshiastron
@parthjoshiastron 4 жыл бұрын
Hey John, Cool video. I couldn't get the definition (F12) thing working, any suggestions?
@JohnCodes
@JohnCodes 4 жыл бұрын
Good question - the Gopls server is still in beta, so they definitely have some bugs to iron out. A re-install may do the trick. If you open the command palette and "Go: install tools" you can re-check gopls. Also, make sure that your gopath and your whole go environment is set up correctly. And if you're still running into issues, may be worth opening an issue on github
@parthjoshiastron
@parthjoshiastron 4 жыл бұрын
@@JohnCodes Thanks, will try that.
@JohnCodes
@JohnCodes 4 жыл бұрын
@@parthjoshiastron Good luck!
@theflymo
@theflymo 4 жыл бұрын
Great video, very useful, thanks!
@JohnCodes
@JohnCodes 4 жыл бұрын
My pleasure! Glad it was useful!!!
@Theuser2022
@Theuser2022 3 жыл бұрын
Just here to say I'm the 888th subscriber :D
@JohnCodes
@JohnCodes 3 жыл бұрын
Woot wooooot! Thanks much! Already past 1k :D
@corey795
@corey795 4 жыл бұрын
Thanks!
@JohnCodes
@JohnCodes 4 жыл бұрын
You’re welcome!!
@diansaputra7575
@diansaputra7575 4 жыл бұрын
Thanks broo!!
@JohnCodes
@JohnCodes 4 жыл бұрын
No problem!! My pleasure
@guents
@guents 3 жыл бұрын
Thanks for the content. I think vscode can be nice for a small project, but on a big project you can see some weird behavior. Debugging throws weird exceptions, breakpoints in go routines work randomly (sometimes it stops sometimes it doesn't), watches don't work most of the time, even watching a long string is difficult. When you have many files, suggestions don't work anymore and sometimes you can't even save a file. Overall i think it is difficult to do some serious programming in vscode.
@JohnCodes
@JohnCodes 3 жыл бұрын
Yeah I agree. I've actually moved to a mostly vim workflow for speed and efficiency. For really beastly projects I might pull up intelij (especially for kotlin and java projects). But VScode is great for short quick things like JSON / yaml editing
@georgesmith9178
@georgesmith9178 3 жыл бұрын
What is your favorite IDE for developing in Go?
@sharpals2227
@sharpals2227 3 жыл бұрын
Great video
@JohnCodes
@JohnCodes 3 жыл бұрын
Thanks much! Appreciate it
@jimxu1963
@jimxu1963 3 жыл бұрын
your startup screen of vscode is full of “learning rust” projects… interesting… :)
@JohnCodes
@JohnCodes 3 жыл бұрын
...... you caught me LOL
@molekuax8646
@molekuax8646 3 жыл бұрын
Thanks man
@JohnCodes
@JohnCodes 3 жыл бұрын
No problem!
@Nexus-rt1bm
@Nexus-rt1bm 4 жыл бұрын
Thank you
@JohnCodes
@JohnCodes 4 жыл бұрын
You’re welcome!!
@Nexus-rt1bm
@Nexus-rt1bm 4 жыл бұрын
Hey could you share your vscode theme?
@RP-mo2md
@RP-mo2md 3 жыл бұрын
You are jumping from one subject to another skipping steps.
@JohnCodes
@JohnCodes 3 жыл бұрын
Thanks for the feedback! This was one of the first tutorial type videos I did and I've been working on improving my skills here - again, thanks for the feedback!
@achmadhanif1451
@achmadhanif1451 3 жыл бұрын
Thanks man
@JohnCodes
@JohnCodes 3 жыл бұрын
My pleasure!
you NEED to use VS Code RIGHT NOW!!
12:48
NetworkChuck
Рет қаралды 582 М.
VScode for Golang [2022] Simple setup!
7:27
John McBride
Рет қаралды 70 М.
🎈🎈🎈😲 #tiktok #shorts
0:28
Byungari 병아리언니
Рет қаралды 4,5 МЛН
Vampire SUCKS Human Energy 🧛🏻‍♂️🪫 (ft. @StevenHe )
0:34
Alan Chikin Chow
Рет қаралды 138 МЛН
Хаги Ваги говорит разными голосами
0:22
Фани Хани
Рет қаралды 2,2 МЛН
Golang: The Last Interface Explanation You'll Ever Need
17:58
Flo Woelki
Рет қаралды 24 М.
Is Functional Programming DEAD Already?
21:07
Continuous Delivery
Рет қаралды 74 М.
Why I Cant Stand IDE's After Using VIM | Prime Reacts
17:51
ThePrimeTime
Рет қаралды 396 М.
Learn Go in 12 Minutes
13:34
Jake Wright
Рет қаралды 952 М.
My Favorite Way To Handle Dev Environments | VS Code Devcontainers
30:05
How Senior Programmers ACTUALLY Write Code
13:37
Thriving Technologist
Рет қаралды 1,6 МЛН
Visual Studio Code for C/C++ on Linux (2021)
13:04
CodeVault
Рет қаралды 114 М.
How to Set Up Visual Studio Code for golang ( Go Language )
6:36
Example Program
Рет қаралды 19 М.