go.nvim icon indicating copy to clipboard operation
go.nvim copied to clipboard

vim shows import error until re-open

Open ep4sh opened this issue 1 year ago • 2 comments
trafficstars

Hi, could you please tell me either this is my misconfiguration or a bug:

  1. create new dir:
mkdir bla && cd bla
  1. create new module:
go mod init ep4sh
  1. open file main.go and 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
}

  1. Exec go mod tidy / go get - to download dependency.
  2. See an error in nvim: image 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!

ep4sh avatar May 29 '24 11:05 ep4sh

You may need to run GoGet .

ray-x avatar May 29 '24 12:05 ray-x

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.

ep4sh avatar Jun 02 '24 11:06 ep4sh