Finding GO path for VS Code - Golang

I had installed from downloads pages of golang.org and installed Golang's official extension for VS Code. Since I had installed from downloads page, the extension has trouble finding the golang default path.

To resolve this, I had to add an alternate path in settings.json for Go. For that I needed to find the package directory and a simple SO search voila et,

package main

import (

func main() {
    gopath := os.Getenv("GOPATH")
    if gopath == "" {
        gopath = build.Default.GOPATH

- 1 toast