Home  >  Article  >  Backend Development  >  What is the difference between export and "go env -w"

What is the difference between export and "go env -w"

WBOY
WBOYforward
2024-02-05 23:57:03454browse

导出和“go env -w”有什么区别

Question content

What exactly does "go env -w" do? I've skimmed this long proposal but haven't figured out the gist of it yet. Right now,

  • Will it write such a setting anywhere in Go related configuration files?
  • What is the difference between the two methods if I simply use export?
  • If I use "go env -w", how do I unset it when I no longer need it?

By the way, what I'm asking about is "go env -w GOPRIVATE". What difference would it make if I did it either way.


Correct answer


Rungo help environment:

Environment variables take precedence. Therefore, if GOPRIVATE is set on your system, it will be used. If not, or if you unset it, the value you set with go env -w GOPRIVATE=xy will be used.

If you run go help env:

Therefore, you can cancel manually changed GOPRIVATE defaults by running go env -u GOPRIVATE.

The above is the detailed content of What is the difference between export and "go env -w". For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:stackoverflow.com. If there is any infringement, please contact admin@php.cn delete