PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label gopls. Show all posts
Showing posts with label gopls. Show all posts

Friday, August 19, 2022

[FIXED] When should you set the $GOPATH variable?

 August 19, 2022     environment-variables, go, gopath, gopls, visual-studio-code     No comments   

Issue

Can anyone explain when to set $GOPATH? I know it's in the default, C:\Users\Username\go, location, but what if all my coding projects live in Z:<codelocation> ?


Solution

From the documentation:

The Go path is used to resolve import statements.

The GOPATH environment variable lists places to look for Go code.

When using modules, GOPATH is no longer used for resolving imports. However, it is still used to store downloaded source code (in GOPATH/pkg/mod) and compiled commands (in GOPATH/bin).

Assuming you're using modules, which you probably should be, the setting of GOPATH will not impact your projects regardless of where you put them. It only needs to be set somewhere so the Go tools have a cache to store libraries and binaries.



Answered By - Hymns For Disco
Answer Checked By - Marie Seifert (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing