![]() ![]() ![]() Click on Extensions > Go in the left-hand navigation of the Settings Editor and scroll down to Build Flags.Click on Folder below the search bar in the Settings Editor and select the folder for the project that you are configuring.Type CTRL+, to open up the Settings Editor.Click on the folder for your project in the Explorer.This is all well and good when we are writing code in a text editor and compiling and running our tests on the command line, but if we are going to use VSCode there are a few things that you need to do to configure the project so that the code is compiled correctly in the IDE while you are working on it and debugging your code. In order to separate out our unit test and integration test code we include the integration build tag in each file that is part of the integration tests, and the unit build tag in each file that is part of the unit tests. Then this code will only be compiled if we run the following command that includes the integration build tag. One of the ways to separate unit and integration test code in golang is to use build tags.Ī TLDR on build tags is that it is a way to tell the compiler which source code to include or ignore when doing a build.įor example: if we have the following golang code: // +build integration
0 Comments
Leave a Reply. |