alpacahq / alpaca-trade-api-go

Go client for Alpaca's trade API
Apache License 2.0
328 stars 93 forks source link

Install issue #251

Closed PopeDCM closed 1 year ago

PopeDCM commented 1 year ago

After running go install github.com/alpacahq/alpaca-trade-api-go/v3/alpaca@latest I get the error The go.mod file for the module providing named packages contains one or more replace directives. It must not contain directives that would cause it to be interpreted differently than if it were the main module.

lilcriispy commented 1 year ago

@PopeDCM I was having troubles with this too, using go get -u github.com/alpacahq/alpaca-trade-api-go/v3/alpaca from inside of my Alpaca project seemed to do the trick (not a fix, just a workaround)

gnvk commented 1 year ago

Now the error message is clearer:

$ go install github.com/alpacahq/alpaca-trade-api-go/v3/alpaca@latest
package github.com/alpacahq/alpaca-trade-api-go/v3/alpaca is not a main package

You can't "install" the SDK, because it's a library, not an executable. As @lilcriispy and the readme suggests, use go get or go mod tidy to add it to your project.