Blackrush
Blackrush

Reputation: 117

Unable to import a package

I'm having some trouble to import a package though I added a valid import path. I can make it works by using a alias but when I try a recompile, it fails again and complains again.

It first complains about an unused package and then about a undefined symbol. Here is the Travis-CI build : https://travis-ci.org/Blackrush/gofus/builds/12145834 the same is happening on my computer using go1.1.2 linux/amd64.

Why does it fail to compile and how can I fix this issue ?

Upvotes: 1

Views: 146

Answers (1)

jimt
jimt

Reputation: 26370

The code in package github.com/Blackrush/gofus/realm/network/frontend has the package definition network, yet you are referencing it as frontend.XXX in realm/config.go.

This can be fixed by changing the references to network.XXX or by changing package network to package frontend in the frontend source code.

In general, it is best to give a package the same name as the directory in which its source is contained. So all code in directory foo should have a package declaration package foo. Otherwise you may run into confusing errors like this.

Upvotes: 2

Related Questions