Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resty v2 Go Modules Compatibility Error #7

Closed
seanmalloy opened this issue Sep 23, 2019 · 8 comments
Closed

Resty v2 Go Modules Compatibility Error #7

seanmalloy opened this issue Sep 23, 2019 · 8 comments

Comments

@seanmalloy
Copy link
Contributor

Similar to #6 i'm seeing the below error when trying to use Go Modules to build my project. I'm using Go Lang version 1.12.9.

CGO_ENABLED=0 GO111MODULE=on go build -o prom2webex
go: finding github.com/google/go-querystring/query latest
go: github.com/go-resty/[email protected]: parsing go.mod: unexpected module path "gopkg.in/resty.v1"
go: error loading module requirements

Here is main.go ...

package main

import (
        "fmt"
        "log"

        webexteams "github.com/jbogarin/go-cisco-webex-teams/sdk"
)

// Client is Webex Teams API client
// var Client *webexteams.Client

func main() {
        // Client is Webex Teams API client
        Client := webexteams.NewClient()

        // TODO: remove hard coded roomID
        myRoomID := "myroomid"

        // POST messages - Text Message
        message := &webexteams.MessageCreateRequest{
                Text:   "This is a text message fo testing",
                RoomID: myRoomID,
        }
        newTextMessage, _, err := Client.Messages.CreateMessage(message)
        if err != nil {
                log.Fatal(err)
        }
        fmt.Println("POST:", newTextMessage.ID, newTextMessage.Text, newTextMessage.Created)

        // POST messages - Markdown Message
        //markDownMessage := &webexteams.MessageCreateRequest{
        //      Markdown: "This is a markdown message. *Italic*, **bold** and ***italic/bold***.",
        //      RoomID:   myRoomID,
        //}
        //newMarkDownMessage, _, err := Client.Messages.CreateMessage(markDownMessage)
        //if err != nil {
        //      log.Fatal(err)
        //}
        //fmt.Println("POST:", newMarkDownMessage.ID, newMarkDownMessage.Markdown, newMarkDownMessage.Created)
}

Here is go.mod ...

module path/to/my/project

go 1.12

require github.com/jbogarin/go-cisco-webex-teams v0.3.0

require github.com/go-resty/resty/v2 v2.0.0

According to the resty v2 doc the correct import path for using resty v2 with Go Modules is import "github.com/go-resty/resty/v2".

https://github.com/go-resty/resty#installation
https://github.com/go-resty/resty#usage

Can/should the code in this project we updated to import "github.com/go-resty/resty/v2" instead of "github.com/go-resty/resty"?

@seanmalloy
Copy link
Contributor Author

@jbogarin I submitted pull request #8 with a proposed fix for this issue. I confirmed that my project now compiles using Go Modules using my proposed changes. Let me know what you think.

My updated go.mod file ...

module path/to/my/project

go 1.12

require github.com/jbogarin/go-cisco-webex-teams v0.3.0

// Work around issue with github.com/jbogarin/go-cisco-webex-teams Go Module support
replace github.com/jbogarin/go-cisco-webex-teams => github.com/KohlsTechnology/go-cisco-webex-teams v0.3.1-0.20190923041206-1f5a3fb1071a

@jbogarin
Copy link
Owner

PR #8 merged. Closing this issue

@darrenparkinson
Copy link

Hi, I don't think this is fixed?

@jbogarin
Copy link
Owner

@darrenparkinson do you need me to reopen this? I honestly just merge the PR. But if you need me to run more tests, I can do it.

@seanmalloy
Copy link
Contributor Author

@darrenparkinson are you not able to use this library with go modules after #8 was merged? Can you provide more details on the problem you are seeing? Is there are error message?

@darrenparkinson
Copy link

Hi, thanks for the response. Apologies for the delay.

So yes, creating a new simple module and running it results in the same error. Does it need a new release?

go.mod:

module github.com/whatever/mytestapp

go 1.14

require github.com/jbogarin/go-cisco-webex-teams v0.3.0 // indirect

Error:

go: finding module for package github.com/peterhellberg/link
go: finding module for package github.com/google/go-querystring/query
go: finding module for package github.com/go-resty/resty
go: found github.com/go-resty/resty in github.com/go-resty/resty v1.12.0
go: found github.com/google/go-querystring/query in github.com/google/go-querystring v1.0.0
go: found github.com/peterhellberg/link in github.com/peterhellberg/link v1.1.0
go: github.com/jbogarin/go-cisco-webex-teams/sdk imports
        github.com/go-resty/resty: github.com/go-resty/[email protected]: parsing go.mod:
        module declares its path as: gopkg.in/resty.v1
                but was required as: github.com/go-resty/resty

@seanmalloy
Copy link
Contributor Author

@darrenparkinson you have to use master instead of v0.3.0 until a new release is created.

@jbogarin
Copy link
Owner

That's my bad. I'm trying to add some of the new APIs like devices, places and such. I'll get to it this week and create a new release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants