gopath is not deprecated
Maybe you’ve heard someone say something like;
“Gopath is deprecated, use go modules”.
While what they mean to say is true, that is developing in gopath mode is deprecated. When interpreted literally this statement is not true. And very likely confuses new comers to go. Lets peel back a layer of the onion and understand exactly what it is we mean to say.
The action of developing inside of Gopath and not using modules is deprecated. This is (uncommonly) called ‘gopath development mode’ or just ‘gopath mode’ and is how development was done in go prior to go modules. That has all changed when go got modules (go’s dependency management system). You can still write code utilizing gopath mode, however it is discouraged as at this point you should be using go modules in all of your go projects. Thus why we say that developing in gopath mode is deprecated.
Maybe this confusion stirs from a few poorly worded google results. 1, 2, 3
So gopath mode is deprecated. But what about gopath, what is it and what is it used for?
Gopath is an environment variable that which defaults to $HOME/go. And is used to determine defaults for where modules are downloaded to($GOMODCACHE), where binaries are installed ($GOBIN), and where checksums are stored ($GOPATH/pkg/sumdb).
So gopath is itself is still very much in use, and will continue to be in the future.
All this info and more can be found in this very helpful wiki!