GoLand 2021.1 Help

Source code hierarchy

With GoLand, you can examine the hierarchy of types, methods, and calls and explore the structure of source files.

Build hierarchies

  • Type hierarchies show what interfaces are implemented by the type and what types implement the interface.

  • Call hierarchies show callers or callees of a method or a function.

When built, a hierarchy can be immediately viewed and examined in the Hierarchy tool window. By default, every new built hierarchy overwrites the contents of the current tab. You can retain the current tab and have the next hierarchy built in a new one.

Build a type hierarchy

  1. Select the desired type or interface in the editor.

  2. From the main menu, select Navigate | Type Hierarchy or just press Ctrl+H.

    Type hierarchy shown in the Hierarchy Tool Window

Build a call hierarchy

  1. Open the file in the editor and place the caret at the declaration or usage of the desired method or a function.

  2. From the main menu, select Navigate | Call Hierarchy or press Ctrl+Alt+H.

    Build a call hierarchy

Retain a hierarchy tab

  • In the Hierarchy tool window, click the Pin Tab button Pin button on the toolbar.

Viewing hierarchies

Open the Hierarchy tool window

  1. Make sure, you have already built hierarchies to show, see Building hierarchies above.

  2. Select View | Tool Windows | Hierarchy from the main menu.

Navigate between the tabs

  • Click the currently displayed tab, and select the next one to display from the list.

Switch between callers and callees

  • With GoLand, you can build and explore ascending or descending hierarchies, that is, callee or caller methods, parent or children types, and so on.

    Click the Caller Hierarchy toolbar button or the Callee Hierarchy toolbar button to show caller methods or callee methods respectively.

Hierarchy tool window buttons

ItemDescriptionAvailable In
the Supertypes Hierarchy buttonDepending on the hierarchy type:
  • Type hierarchies: shows the hierarchy of each supertype of the current type.

  • Call hierarchies: shows the callers of the selected method.

All hierarchies
the Subtypes Hierarchy button

Depending on the hierarchy type:

  • Type hierarchies: shows all types that extend the selected type.

  • Call hierarchies: shows the callees of the selected method.

All hierarchies
the Sort Alphabetically buttonSorts all elements within a tree alphabetically.Type hierarchies
Scope

Use this list to limit the scope of the current hierarchy:

  • Project: traces usages of the method across the project.

  • Test: traces usages of the method across the test types.

  • All: traces usages of the method across the project and the libraries.

  • This type: limits the scope to the current type.

In addition to the preconfigured scopes, you can define your own one. To define a scope, select Configure from the list and define the required scope in the Scopes dialog.

Call hierarchies
the Respecting interface calls buttonSearches for calls of the selected method in all structures that implement this interface method. By default, you see a list of calls for the selected method only in the current structure.Call hierarchies
the Refresh buttonShows all updated types or type structures.All hierarchies
the Navigate with Single Click buttonMoves to a file and a section in a source code that corresponds to the selected node in the hierarchy tree.All hierarchies
the Expand All buttonExpands all nodes.All hierarchies
icons.actions.expandall.pngExpands all nodes of the hierarchy tree.All hierarchies
the Pin buttonLocks the current tab from closing and reusing. Results of the next command are displayed in a new tab.All hierarchies
the Export to Text FileExports a hierarchy into a text file. You can specify a location for this file.All hierarchies
the Close buttonCloses the tool window.All hierarchies
Last modified: 08 March 2021