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 release plan and Create migration guide from v1 to v2 #235

Closed
jeevatkm opened this issue Mar 13, 2019 · 15 comments
Closed

Resty v2 release plan and Create migration guide from v1 to v2 #235

jeevatkm opened this issue Mar 13, 2019 · 15 comments
Assignees
Labels

Comments

@jeevatkm
Copy link
Member

jeevatkm commented Mar 13, 2019

This issue is to provide v2 release plan and track the migration guide from v1.x to v2.x

Release Plan:

  • Create a v1 branch from master branch
    • v1 branch will be kept for critical bug fixes only for 6 months, no enhancements and no feature additions
    • Any bug fixes will be ported to master branch to reflect on v2 series
    • v1 will be unsupported and locked down in 6 months from the date of v2 release
  • Make Release Candidates
    • Fix any issues arises
  • Merge v2 branch into the master branch
  • Make a v2.0.0 release from the master branch

Release Candidates:

v2.0.0-rc.1 is ready to try it out.

# add it go.mod
github.com/go-resty/resty v2.0.0-rc.1

Migration Guide: (In-progress)

v2 brings https://github.com/go-resty/resty/issues?q=is%3Aclosed+milestone%3A%22v2.0.0+Milestone%22

@jeevatkm jeevatkm added documentation v2 For resty v2 labels Mar 13, 2019
@jeevatkm jeevatkm added this to the v2.0.0 Milestone milestone Mar 13, 2019
@jeevatkm jeevatkm self-assigned this Mar 13, 2019
@jeevatkm jeevatkm pinned this issue Mar 13, 2019
@jeevatkm
Copy link
Member Author

@Crevil, @1995parham, @moorereason, @h7kanna, @sudo-suhas, @topillar, @pborzenkov, @incubus8, @xakep666, @neganovalexey

I have just gathered the names from resty v2 discussion since v2 release candidate 1 is ready I thought to collect the user feedback. Could you please try rc1 and share feedback?

Thanks.

@sudo-suhas
Copy link
Contributor

@jeevatkm The go module support has not been implemented correctly:

➜ mkdir -p /tmp/scratchpad/hello && cd $_

➜ go mod init github.com/sudo-suhas/hello
go: creating new go.mod: module github.com/sudo-suhas/hello

➜ cat <<EOF > main.go
package main

import (
	"fmt"
)

func main() {
	fmt.Println("hello")
}
EOF

➜ cat go.mod
module github.com/sudo-suhas/hello

➜ go get github.com/go-resty/resty@v2
go get github.com/go-resty/resty@v2: no matching versions for query "v2"

➜ go get github.com/go-resty/resty@v2.0.0-rc.1
go: finding github.com/go-resty/resty v2.0.0-rc.1
go: finding golang.org/x/net v0.0.0-20190311183353-d8887717615a
go: finding golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
go: finding golang.org/x/text v0.3.0
go: finding golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
go: downloading github.com/go-resty/resty v0.0.0-20190313065924-46fc51a18d33
go: downloading golang.org/x/net v0.0.0-20190311183353-d8887717615a

➜ cat go.mod
module github.com/sudo-suhas/hello

require github.com/go-resty/resty v0.0.0-20190313065924-46fc51a18d33 // indirect

Ideally, I should refer to resty with the import github.com/go-resty/resty/v2 but that won't work:

➜ cat main.go
package main

import (
	"fmt"
	_ "github.com/go-resty/resty/v2"
)

func main() {
	fmt.Println("hello")
}

➜ go build
go: downloading github.com/go-resty/resty/v2 v2.0.0-rc.1
main.go:5:2: unknown import path "github.com/go-resty/resty/v2": cannot find module providing package github.com/go-resty/resty/v2

See https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher, https://blog.samwhited.com/2019/01/supporting-go-modules/, https://www.youtube.com/watch?v=ms5l0zxC-uM

@moorereason
Copy link
Contributor

It's not clear to me that using the /v2 import path and @v2 version should work yet. According to semver, v2.0.0-rc.1 < v2.0.0. My reading of the Go docs says that /v2 and @v2 means v2.0.0 or higher.

It's odd that go build downloads the rc.1 pre-release and then won't build with it. That may be a bug in the Go tools.

@jeevatkm
Copy link
Member Author

@moorereason Releasing multiple version has more than one approach with go mod. I have tested them with the sample program for v2.0.0-rc.1.

Are you getting any build error? what is it? please let me know.

@jeevatkm
Copy link
Member Author

@sudo-suhas As mentioned in this issue main content. Please refer it as -

github.com/go-resty/resty v2.0.0-rc.1

@Crevil
Copy link

Crevil commented Mar 19, 2019

I'll try to test this out this week or the next. Do you have a time frame for feedback that I need to aim for?

@1995parham
Copy link

I tried with github.com/go-resty/resty v2.0.0-rc.1 then after running go build it replaces it with github.com/go-resty/resty v0.0.0-20190313065924-46fc51a18d33 is it ok?

@jeevatkm
Copy link
Member Author

@1995parham It is okay. This is pre-release of major version, that's why it resolves like this. Any feedback about v2 usage?

@1995parham
Copy link

@jeevatkm I switched to v2 in one of my projects and everything looks good to me. Thanks for your awesome work. If anything happens I will comment about it here.

@jeevatkm
Copy link
Member Author

@1995parham I'm glad to hear your feedback 👍, please keep me posted.

FYI, there will be one more breaking change with new feature addition on Retry, refer to #237, I will make rc.2 once it's ready 😄

@moorereason
Copy link
Contributor

I updated one of my tools to v2. Below is a snippet of the diff that captures the essence of the changes. It was pretty simple.

index c2e0bfb..44873f1 100644
--- a/api/api.go
+++ b/api/api.go
@@ -143,10 +143,10 @@ func (c *Config) UpdateSet(set *Set, v url.Values) error {

        uri := fmt.Sprintf("%s/sets/%d", apiBaseURL, set.ID)

-       _, err := resty.SetDebug(c.Debug).R().
+       _, err := resty.New().SetDebug(c.Debug).R().
                SetHeader("Accept", "application/json").
                SetAuthToken(c.AuthToken).
-               SetMultiValueFormData(v).
+               SetFormDataFromValues(v).
                SetResult(&newSet).
                SetError(&e).
                Put(uri)

My contribution to a "migration guide" of the breaking API changes that affected me:

  • Global DefaultClient variable has been removed. As a result, AddRetryCondition(), OnAfterResponse(), OnBeforeRequest(), RemoveProxy(), and all Set*() functions were removed. Use resty.New() instead.
  • *Request.SetMultiValueFormData() was renamed to *Request.SetFormDataFromValues().
  • *Request.SetMultiValueQueryParams() was renamed to *Request.SetQueryParamsFromValues().

@jeevatkm
Copy link
Member Author

@moorereason Thanks for trying out rc.1 and sharing your notes.

I would like to mention one thing from your git diff above. Do not create Resty Client for every request.

-       _, err := resty.SetDebug(c.Debug).R().
+       _, err := resty.New().SetDebug(c.Debug).R().

@Crevil

I'll try to test this out this week or the next. Do you have a time frame for feedback that I need to aim for?

Actually I do not have fixed timeline for now. I'm hoping I could make the v2 release in month of April.

@jeevatkm
Copy link
Member Author

All - I have just made a v2.0.0-rc.2 release.

@jeevatkm
Copy link
Member Author

v2 Release notes draft is ready. Just finishing up final user request changes.


Release Notes

How to get?

go.mod

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

go get

go get -u github.com/go-resty/resty

How to use?

import "github.com/go-resty/resty"

New Features

Enhancements

Breaking Changes - Migrating v1.x to v2

@jeevatkm
Copy link
Member Author

I'm closing this one, preparing for v2 release.

@jeevatkm jeevatkm unpinned this issue Jul 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

5 participants