Possibility to create a value for function param that is pointer, on the spot




type Thing struct {

  // fields


func Foo(t *Thing) {

  // code


func Bar() {




Now when I have my cursor at {CURSOR}, I can see the params suggestions pop up. It says "t *Thing". So it knows a *Thing is supposed to go in there. But there is no way I can press a button to generate a *Thing on the spot; when I press ctrl+space, I get only "nil" as a suggestion. Would be nice if there was also an option to generate code for a *Thing.

Official comment

You can use the Smart Type Completion and it should generate the right thing (tested in the latest version, 2020.1.3), see the image below:

Found it! I typically mostly use the normal suggestions (ctrl+space, I think?). It is a bit confusing that that one **does** show a suggestion for a non-pointer value, but not for a pointer value.



So then herby, if possible, I would like to make this a feature request/suggestion, because it's nice to be able to consistently use the same keyboard shortcut to get suggestions.

Nonetheless, thanks for helping me find where the option was hidden.


I'll ask my colleagues if we can do anything about this and raise an issue as a follow-up if needed, which I'll link here.


Meanwhile, another way to get the pointer there is to use Postfix Completion and do something like in the following gif:


Good idea, I can try to make more use of those. Thanks!


Please sign in to leave a comment.