rwynn / gtm

gtm (go tail mongo) is a MongoDB event listener
MIT License
147 stars 33 forks source link

Error importing v2.0.6 with new official mongo golang package #22

Closed paracha3 closed 4 years ago

paracha3 commented 4 years ago

I just started very simple go project for changeStream with mongodb official golang package. I am using latest version of both packages. My go.mod files looks like

module mongos

go 1.13

require (
    github.com/rwynn/gtm v2.0.6
    go.mongodb.org/mongo-driver v1.3.4
)

When i try to build go build main.go i get the following error message

go: errors parsing go.mod: /Users/johnsmith/Desktop/Mongos/go.mod:6: require github.com/rwynn/gtm: version "v2.0.6" invalid: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v2

rwynn commented 4 years ago

Use go get github.com/rwynn/gtm@master to add the latest version to go.mod. This repository needs to be fixed to support go modules at version 2.

rwynn commented 4 years ago

@paracha3 this should be fixed now if you put github.com/rwynn/gtm/v2 v2.0.9 in your go.mod. Also, update the import in your go code to use github.com/rwynn/gtm/v2.

paracha3 commented 4 years ago

I will give it a shot tomorrow morning and post back. Thanks for prompt fix!

paracha3 commented 4 years ago

Its working fine.