go - What is the programming paradigm behind the $GOPATH, what does it do? -


as new golang, i'm perplexed notion of $gopath.

the thing in experience reminds me of "system folder path" (c:\windows, c:\program files) on microsoft windows machines- somehow conceptually related this?

i've seem description of from go team, it's practical, talks what is, opposed why is.

so then, why it?

gopath variable indicates dependencies of application installed. path directory store packages application might use.

any application of reasonable size has dependencies. in golang, these come in form of packages. @ compile time, location of dependencies (i.e. packages use) needs known such executable can built.

they can either stored @ fixed, predefined location or make somehow user able specify location himself. first approach has lot of downsides (for example, impossible support operating systems different directory structure). thus, designers of go tool decided make user configurable means of variable. gives user more flexibility, such ability group dependencies different projects in different directories.

the usage of environment variable (as gopath) not limited golang. java has classpath, python pythonpath , on (each of them quirks, same basic role).


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -