Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 97445

Golang with vs code : invalid type error while the type exist

$
0
0

I use go (golang) with vs code on ubuntu 18.04.

I use gopls as laguage server.

my code is organized something like

/package a
 f.go
/package moretypes
 g.go

and I use type from moretypes in a. meaning in g.go i have:

type MyType stuct{
...}

and in f.go i have:

myType := moretypes.MyType{}
...

and it works just fine from the Go view, but the vs code notify me that myType is invalid type and it refuse to recognize it and don't let auto completion.

(I used to have the tools that vs code recommend but after i upgrade go to 1.14 some features didn't work and therefor i switched to gopls. )


Viewing all articles
Browse latest Browse all 97445

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>