Home > Software engineering >  Should I add the `wire_gen.go` to gitignore
Should I add the `wire_gen.go` to gitignore

Time:06-22

I am just coming into the Go programing language.

As we known, https://github.com/google/wire is the official solution for dependency injection.

We we run the wire command, this tool will look up the wire.go file and generate the wire_gen.go file according to the dependency relation structure.

But the problem is, should I add the wire_gen.go to gitignore?

IMO, the files which are auto-generated should be ignored because it can prevent people modify these files by fault.

But the official doc says that this file should be added to the version control system, why?

CodePudding user response:

If someone would run go get, go install or go build on your code it would fail if the generated file is not part of the repository. Go generate is never run automatically by go build, go test, and so on. It must be run explicitly.

CodePudding user response:

This file is like others auto-generated, should not add to .gitignore

  • Related