Windows configuration system environment variables
Variable name: GO111MODULE
Variable value: on
then save and restart cmd/powershell/bash
I remember that
mainly depends on whether you have a go mod file in your directory.
this can only be modified in the current session. In fact, you can change the environment variable manually to on, windows directly sets it, and linux modifies the command / etc/profile
temporarily, which is only valid for this session. To put it bluntly, if you close this window setting, it will become invalid, even if you do not close the current window and open a new session window, there is no such setting.
if you want to take effect permanently, write it to the environment variable file in your personal directory or to the global environment variable file
Add to
~ / .bash_profile
export GO111MODULE=on
source ~ / .bash_profile still indicates that GO111MODULE is not open.
how does the GO111MODULE itself relate to the GO program?
1, this setting is temporary
2, permanent setting is,
1) window setting environment variable: GO111MODULE:on
2) linux modify / root/.profile file, add export GO111MODULE=on, and run
source / root/.profile take effect immediately