How can I ensure that I use different dependencies depending on the environment/build? For example, I do not want to include some dependencies required for the testing environment in my production build?
Asked
Active
Viewed 155 times
0
-
Are you importing those testing dependencies only in your *_test.go files? If so, those files aren't included in go-build's output, neither are the deps imported in those files. – mkopriva Nov 26 '18 at 10:24
-
@mkopriva thanks for your answer. could you please show some source for this info? – Sammy Nov 27 '18 at 10:03
-
https://golang.org/cmd/go/#hdr-Compile_packages_and_dependencies *" When compiling packages, build ignores files that end in '_test.go'. "* – mkopriva Nov 27 '18 at 10:06
-
@mkopriva thanks a lot for the info. If I am importing the dependency A in _test.go file, and the dependency B is imported only in A, would B included in go-build or not? Technically, B is not imported only in _test.go file. How can I even verify this myself? – Sammy Dec 18 '18 at 11:10