GoLand analyses code in files that are opened in the editor and highlights anomalous code as you type.
To quickly see the results of the instant analysis, take a look at the icon in the top-right corner of the editor. If an error is detected, you will see . The icon stands for warnings; the icon indicates that typos are detected. If everything is correct, you will see .
The color stripe in the right gutter also marks detected code problems and helps you quickly access the corresponding code strings without scrolling the file. Hover over a mark on the stripe to see the detected problem in a tooltip. Click a mark to jump to the corresponding code string.
You can navigate from one highlighted string to another in the editor within a file by pressing F2 (to go to the next problem) and Shift+F2 (to return to the previous one).
For the majority of code problems, GoLand provides quick-fixes that you can see and apply by pressing Alt+Enter.
Run inspections manually
Some inspections require global code analysis, and that is why they are disabled in the editor. These inspections are listed in Show Only Batch-Mode Inspections.. Click and select
If you want to get a full report of all detected anomalous code strings, run inspections explicitly.
Run all inspections
From the main menu, select.
Select the scope of files that you want to analyze. You can also click and configure a new scope.
Select the inspection profile that you want to apply. To configure a new profile, click in the Inspection profile area.
Click OK to start the analysis.
Run a single inspection
Running a single inspection is useful in case you want to track a specific problem. If you find a warning in a file, you can inspect your entire project, or the necessary scope of files, to ensure that there are no more such warnings in your code base.
From the main menu, selectCtrl+Shift+Alt+I.
Type the inspection name in the popup. Use CamelHumps to match camel case words and white spaces with initial letters of the words. The suggestion list will show you inspections that match your search request.
If you are not sure that you are selecting the correct inspection, you can view its description. To do so, select an inspection in the popup and press Ctrl+Q.
Double-click the necessary inspection to open its settings.
In the dialog that opens, select the scope of files that you want to analyze.
The File Masks(s) option helps you narrow down the number of files that will be inspected.
Select the checkbox and specify a pattern of characters and wildcards that matches the names of files you want to analyse. Use a comma to separate multiple file masks.
Some inspections might have additional options that you will be prompted to configure.
These settings will only be applied to this run, and will not affect this inspection's configuration in your current profile.
The IDE will show you the inspection results in the dedicated tool window. There you can examine and fix detected problems.
Run inspections offline
In addition to running code inspections from the IDE, you can launch inspections from the command line without actually running GoLand. The inspection results will be stored in an XML file.
Change the order of scopes
By default, all enabled code inspections analyze all files in your project. Depending on your needs, you can run the same inspection in more than one scope of files with different settings.
If one file is included in two or more scopes, and you enable an inspection in these scopes, GoLand will process them according to their order in the list of scopes — the uppermost scope will have the highest priority, and therefore, it will be analyzed first.
Select any inspection from the list.
From the In All Scopes list, select Edit Scopes Order.
Select the necessary scope, and use and to move it up and down the list.
If needed, create a new scope. To do so, click (Edit Scopes), specify scope settings, and select the files and folders that you want to include in it.