I am trying to use lnd/macaroons in my Go program but I fail at it.
Your environment
version: master
operating system: macos
Steps to reproduce
Here I provide a simple example in which I can reproduce the issue but notice that the application is actually bigger and uses many more packages.
package main
import (
"io/ioutil"
"log"
"github.com/lightningnetwork/lnd/macaroons"
"google.golang.org/grpc/credentials"
macaroon "gopkg.in/macaroon.v2"
)
func main() {
grpcCredential, err := credentials.NewClientTLSFromFile("/path/to/tls.cert", "")
if err != nil {
log.Fatal(err)
}
providedMacaroon, err := ioutil.ReadFile("/path/to/admin.macaroon")
if err != nil {
log.Fatal(err)
}
mac := &macaroon.Macaroon{}
if err = mac.UnmarshalBinary(providedMacaroon); err != nil {
log.Fatal(err)
}
// not doing anything because this is just an example
_ = macaroons.NewMacaroonCredential(mac)
}
When getting the dependencies I see this error.
Using Go modules (and outside of $GOPATH):
$ go get ./...
(...)
go: finding github.com/lightningnetwork/lnd/macaroons latest
build playg: cannot load github.com/lightningnetwork/lnd/macaroons: cannot find module providing package github.com/lightningnetwork/lnd/macaroons
I tried clearing modules cache with go clean -modcache but it did not help.
Not using Go modules (inside of $GOPATH):
$ go get ./...
# github.com/lightningnetwork/lnd/macaroons
../github.com/lightningnetwork/lnd/macaroons/service.go:9:2: imported and not used: "github.com/coreos/bbolt" as bolt
../github.com/lightningnetwork/lnd/macaroons/store.go:10:2: imported and not used: "github.com/coreos/bbolt" as bolt
../github.com/lightningnetwork/lnd/macaroons/store.go:49:2: undefined: bbolt
The error says that the import was aliased to bolt so I checked and that's not the case in my filesystem:
$ head $GOPATH/src/github.com/lightningnetwork/lnd/macaroons/store.go | tail -n 1
"github.com/coreos/bbolt"
Background
I am trying to use
lnd/macaroons
in my Go program but I fail at it.Your environment
Steps to reproduce
Here I provide a simple example in which I can reproduce the issue but notice that the application is actually bigger and uses many more packages.
When getting the dependencies I see this error.
I tried clearing modules cache with
go clean -modcache
but it did not help.The error says that the import was aliased to
bolt
so I checked and that's not the case in my filesystem:Expected behaviour
I can import lnd packages in my project.
Actual behaviour
I fail to import lnd packages in my project.