AYLIEN / aylien_newsapi_go

AYLIEN's officially supported Go client library for accessing News API
https://newsapi.aylien.com/
Other
5 stars 2 forks source link

v0.4.0 and Modules #2

Open aleph0ne opened 4 years ago

aleph0ne commented 4 years ago

When using go.mod and the official Aylien SDK for go and go modules, a go get pulls the old SDK of v0.4.0 and I cannot seem to update it.

This is an error: undefined: newsapi.NewAPIClient

This is in my go.mod file: github.com/AYLIEN/aylien_newsapi_go v0.4.0

joesweeny commented 2 years ago

I'm getting a similar issue when executing go get -u github.com/AYLIEN/aylien_newsapi_go it installs the v5.0.1 dependency.

When I explicitly try to install the v4.6.0 dependency I get the following error message:

require github.com/AYLIEN/aylien_newsapi_go: version "v5.0.1" invalid: module contains a go.mod file, 
so major version must be compatible: should be v0 or v1, not v5

It would be good to get an answer on this please.

FrontSide commented 2 years ago

Thanks for bringing this to our attention. There is indeed a bug in our versioning and we will be working on a proper fix for this.

In the meanwhile, you can download any tagged version of the Go SDK by using the related git commit hash, rather than the version number, which can be found on the Releases page.

For example. To install v5.0.1, run

go get github.com/aylien/aylien_newsapi_go@1b42563

in your go module's directory.

In the go.mod file it will then show up as v0.4.1

require github.com/aylien/aylien_newsapi_go v0.4.1-0.20210810092433-1b425636697c

but you can simply ignore this. As long as the git sha matches that of the desired version on Github you are good to go. You can also verify the version by checking the header of any go file in the downloaded package. e.g.

$ cd $GOPATH/pkg/mod/github.com/aylien/aylien_newsapi_go@v0.4.1-0.20210810092433-1b425636697c
$ head client.go

Will show that v5.0.1 is installed.