简体   繁体   中英

Error: Non-standard import “gopkg.in/yaml.v2” in standard package

I'm trying to import go-yaml, from https://github.com/go-yaml/yaml , and I'm seeing an error that Google isn't helping with.

I ran go get gopkg.in/yaml.v2 , but I am getting the error: start.go:6:5: non-standard import "gopkg.in/yaml.v2" in standard package "boxcar" when I try to run my program. I'm not doing anything exotic in my import, either:

package main;

import (
    "os"
    "net"
    "gopkg.in/yaml.v2"  
)

Any help would be appreciated!

Go has 2 paths that must be defined in os environment, GoRoot and GoPath, GoRoot is installation path of Go, there are only "standard packages" in it. GoPath is working folder, there are 3rd party (non-standard) packages in it, your source code folder should be in GoPath and be recognized as non-standard package. like C:\\gopath\\src\\yourproject

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM