Closed TuringZhu closed 3 years ago
build failed with can not find package "."
can not find package "."
go version && huobi_golang version
go version go1.16 darwin/amd64 github.com/huobirdcenter/huobi_golang v0.0.0-20201119082032-67bf5220fbce
example code:
package main import ( "github.com/huobirdcenter/huobi_golang/config" "github.com/huobirdcenter/huobi_golang/logging/applogger" "github.com/huobirdcenter/huobi_golang/pkg/client/orderwebsocketclient" "github.com/huobirdcenter/huobi_golang/pkg/model/auth" "github.com/huobirdcenter/huobi_golang/pkg/model/order" ) func main() { // Initialize a new instance client := new(orderwebsocketclient.SubscribeOrderWebSocketV2Client).Init(config.AccessKey, config.AccountId, config.Host) // Set the callback handlers client.SetHandler( // Connected handler func(resp *auth.WebSocketV2AuthenticationResponse) { if resp.IsSuccess() { // Subscribe if authentication passed client.Subscribe("btcusdt", "1149") } else { applogger.Info("Authentication error, code: %d, message:%s", resp.Code, resp.Message) } }, // Response handler func(resp interface{}) { subResponse, ok := resp.(order.SubscribeOrderV2Response) if ok { if subResponse.Action == "sub" { if subResponse.IsSuccess() { applogger.Info("Subscription topic %s successfully", subResponse.Ch) } else { applogger.Error("Subscription topic %s error, code: %d, message: %s", subResponse.Ch, subResponse.Code, subResponse.Message) } } else if subResponse.Action == "push" { if subResponse.Data != nil { o := subResponse.Data applogger.Info("Order update, event: %s, symbol: %s, type: %s, status: %s", o.EventType, o.Symbol, o.Type, o.OrderStatus) } } } else { applogger.Warn("Received unknown response: %v", resp) } }) // Connect to the server and wait for the handler to handle the response client.Connect(true)}
error info:
cannot find package "." in: /MY_PROJECT_PATH/vendor/github.com/huobirdcenter/huobi_golang/pkg/client/orderwebsocketclient
I build with go mod. After I delete vendor directory, it worked.
build failed with
can not find package "."
go version && huobi_golang version
example code:
error info: