Home > Backend Development > Golang > What is the difference between export and 'go env -w'

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2024-02-05 23:57:03
forward
653 people have browsed it

导出和“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 of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template