Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

yaml

go

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!

like image 757
JB Reefer Avatar asked Apr 27 '16 21:04

JB Reefer


1 Answers

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

like image 138
Andrew Miao Avatar answered Oct 21 '22 09:10

Andrew Miao