What is the `-i` option for "Go tool arguments" in GoLand's Run/Debug Configurations window?

Viewed 1004

What is the -i option for "Go tool arguments" in GoLand's Run/Debug Configurations window?enter image description here

2 Answers

Taken from go help build:

The -i flag installs the packages that are dependencies of the target.
The -i flag is deprecated. Compiled packages are cached automatically.

You will get a message while uses it:

go build: -i flag is deprecated

The -i build flag

The -i flag accepted by go build, go install, and go test is now deprecated. The -i flag instructs the go command to install packages imported by packages named on the command line. Since the build cache was introduced in Go 1.10, the -i flag no longer has a significant effect on build times, and it causes errors when the install directory is not writable.

It is from Go 1.16 Release Notes

So its presence doesn't matter now and you can remove this flag from arguments

Related