Imports in GoLang

Go works differently than I have ever worked in other programming langauges, here some of my notes on go imports

esumits-MacBook-Pro:cobra-example esumit$ go build

main.go:17:8: import “/Users/esumit/Documents/evdev/gopro/cobratest/cobra-example/cmd”: cannot import absolute path

esumits-MacBook-Pro:cobra-example esumit$ $GOPATH/bin/cobra add hello

Error: Rel: can’t make /Users/esumit/Documents/evdev/gopro/cobratest/cobra-example relative to

esumits-MacBook-Pro:cobra-example esumit$ go build

main.go:17:8: cannot find package “cobra-example/cmd” in any of:

/usr/local/go/src/cobra-example/cmd (from $GOROOT)

/Users/esumit/go/src/cobra-example/cmd (from $GOPATH)

 

Refer : https://scene-si.org/2018/01/25/go-tips-and-tricks-almost-everything-about-imports/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s