bmc-toolbox/bmclib

build failure on intelAMT provider

joelrebel opened this issue · 1 comments

Build fails with the Intel AMT provider, the cause seems to be the import overrides https://github.com/bmc-toolbox/bmclib/blob/main/go.mod#L38

To reproduce this issue,

  1. Create a new go project directory mkdir foo && cd foo && go mod init foo
  2. Copy over a bmclib example - https://github.com/bmc-toolbox/bmclib/blob/main/examples/inventory/main.go
  3. Run go mod tidy
  4. Get the latest bmclib/v2 go get github.com/bmc-toolbox/bmclib/v2@4400298
  5. Run go build go build .

The below error will be returned.

# github.com/bmc-toolbox/bmclib/v2/providers/intelamt
/Users/jrebello/go/pkg/mod/github.com/bmc-toolbox/bmclib/v2@v2.0.1-0.20221122065736-4400298194c3/providers/intelamt/intelamt.go:61:3: unknown field 'Logger' in struct literal of type amt.Connection
/Users/jrebello/go/pkg/mod/github.com/bmc-toolbox/bmclib/v2@v2.0.1-0.20221122065736-4400298194c3/providers/intelamt/intelamt.go:70:11: cannot use client (variable of type *amt.Client) as type amtProvider in struct literal:
        *amt.Client does not implement amtProvider (wrong type for IsPoweredOn method)
                have IsPoweredOn() (bool, error)
                want IsPoweredOn(context.Context) (bool, error)
/Users/jrebello/go/pkg/mod/github.com/bmc-toolbox/bmclib/v2@v2.0.1-0.20221122065736-4400298194c3/providers/intelamt/intelamt.go:91:4: unknown field 'Logger' in struct literal of type amt.Connection
/Users/jrebello/go/pkg/mod/github.com/bmc-toolbox/bmclib/v2@v2.0.1-0.20221122065736-4400298194c3/providers/intelamt/intelamt.go:97:14: cannot use client (variable of type *amt.Client) as type amtProvider in assignment:
        *amt.Client does not implement amtProvider (wrong type for IsPoweredOn method)
                have IsPoweredOn() (bool, error)
                want IsPoweredOn(context.Context) (bool, error)

The error goes away if the project importing bmclib/v2 includes these lines in go.mod

replace github.com/ammmze/go-amt => github.com/jacobweinstock/go-amt v0.0.0-20221115190754-36c39f21b864
replace github.com/ammmze/wsman => github.com/jacobweinstock/wsman v0.0.0-20221115191137-e06ce6a5341d

@jacobweinstock

🤦 doh, sorry! I PR'd these changes into the upstream, I think I'll need a proper fork until they make into the upstream proper.