go.nvim
go.nvim copied to clipboard
vim shows import error until re-open
trafficstars
Hi, could you please tell me either this is my misconfiguration or a bug:
- create new dir:
mkdir bla && cd bla
- create new module:
go mod init ep4sh
- open file
main.goand add any code, which includes import section, like the following:
package main
import (
"log"
"time"
env "github.com/Netflix/go-env"
)
type Environment struct {
Home string `env:"HOME"`
Jenkins struct {
BuildId *string `env:"BUILD_ID"`
BuildNumber int `env:"BUILD_NUMBER"`
Ci bool `env:"CI"`
}
Node struct {
ConfigCache *string `env:"npm_config_cache,NPM_CONFIG_CACHE"`
}
Extras env.EnvSet
Duration time.Duration `env:"TYPE_DURATION"`
DefaultValue string `env:"MISSING_VAR,default=default_value"`
RequiredValue string `env:"IM_REQUIRED,required=true"`
}
func main() {
var environment Environment
es, err := env.UnmarshalFromEnviron(&environment)
if err != nil {
log.Fatal(err)
}
// Remaining environment variables.
environment.Extras = es
// ...
es, err = env.Marshal(environment)
if err != nil {
log.Fatal(err)
}
home := "/tmp/edgarl"
cs := env.ChangeSet{
"HOME": &home,
"BUILD_ID": nil,
"BUILD_NUMBER": nil,
}
es.Apply(cs)
environment = Environment{}
err = env.Unmarshal(es, &environment)
if err != nil {
log.Fatal(err)
}
environment.Extras = es
}
- Exec
go mod tidy/go get- to download dependency. - See an error in nvim:
only vim re-open could remove the error
my editor: NVIM v0.10.0 Build type: Release LuaJIT 2.1.1713773202
go.nvim is latest available in Lazy (commit 588ab7b)
Thanks!
You may need to run GoGet .
That helps me a lot, thank you very much! Do you consider making this action automatically? I'm not sure how does it work internally, but as user I wish to have this feature :>
Feel free to close this issue. regards, Pasha.