8

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!

JB Reefer
  • 93
  • 1
  • 1
  • 7
  • I've never seen this error so this is a bit of a guess, but I think you're mixing your own package (`boxcar`) with the Go standard library in `go/src/`, when you need to keep them separate. If so, [here's a quick intro to setting up a GOPATH](http://stackoverflow.com/questions/20628918/cannot-download-gopath-not-set/20629533#20629533) with links to more. – twotwotwo Apr 27 '16 at 22:00
  • I think that error is from trying to import packages in GOROOT. How have you configured your environment? – JimB Apr 27 '16 at 22:11

1 Answers1

14

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

Andrew Miao
  • 156
  • 2
  • 3