-1

I want to clone a git golang project and setup in VS code in windows.Tried to research but havn't been able to figure out. I am using DEP dependency management.

Can someone please help with end to end steps?

2 Answers2

1

A couple of tips:

From there, you can start working on the sources.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

I'll try to help you with how i was able to setup a golang project with a similar set of parameters :

Setting up project: 1)Install Git in VS code. 2) Clone the project from Git repository into a folder(e.g. MyGolangProject) 3) Open command line or VS terminal and execute : dep ensure e.g. {Path}\MyGolangProject\src{DirPath} > dep ensure Note : This would generate a Gopkg.lock file(locks the version of the packages EXCEPT the version should be maintained in the Gopkg.toml) and a vendor folder(vendoring all dependencies) based on our Gopkg.toml file(which contains several types of rule declarations that govern dep's behavior) 4) Set the env variables separately from console or from a bat file if any. 5) Run the main.go file → {Path}\MyGolangProject\src{DirPath} > go run main.go 6)Test the project

Environment variables to be set : 1) GOPATH -->The GOPATH environment variable is used to specify directories outside of $GOROOT that contain the source for Go projects and their binaries. e.g. in the example above, GOPATH will be set to {Path}\MyGolangProject 2) GOROOT → Download the go zip file and extract it into the directory of your choice (e.g. C:\Apps\GO) set the GOROOT environment variable to your chosen path {Path}\GO ,say, e.g. C:\Apps\GO 3) Path → a) Add the bin subdirectory of your Go root (for example, {Path}\GO\bin) to your PATH environment variable. b) Download DEP(Dependency management) ,(and other tools if any e.g. Mockgen for testing) into say C:\Apps\GoDependencies The folder containing dep.exe ( and mockgen.exe if used) to your PATH environment variable(i.e. C:\Apps\GoDependencies)

I hope it helps

Aman Mann
  • 181
  • 2
  • 2