-
Notifications
You must be signed in to change notification settings - Fork 194
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
Updates echo package version to v4. #477
Conversation
@1995parham thanks for opening a PR for this! This breaks backwards compatibility, so it would require a major version bump of the agent. However, I think we should maintain support for both versions for some time, as not everyone is using modules yet. I'm not sure what the best thing to do is. Perhaps introduce |
I agree with your idea, we can create |
@axw I tried to provide a separate module for version 4 of Echo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @1995parham!
Looking good, just a few little things to update.
Besides what I commented on inline, please run "go generate ./scripts" from the top level of the repo, and commit the updated file "scripts/Dockerfile-testing". That will fix the error in https://travis-ci.org/elastic/apm-agent-go/jobs/507736184.
module/apmecho/go.mod
Outdated
@@ -1,17 +1,13 @@ | |||
module go.elastic.co/apm/module/apmecho |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes to the existing go.mod and go.sum can be reverted now, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I forgot that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go.mod and go.sum are still modified, can you please remove the changes from the diff altogether? You can do this by resetting those files to their contents in the master branch:
git reset master go.mod go.sum
git checkout go.mod go.sum
git commit -a -m "Revert changes to go.mod/go.sum"
module/apmecho/v4/example_test.go
Outdated
package apmecho_test | ||
|
||
import ( | ||
"github.com/labstack/echo/v4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of how echo adds the version in the module definition, rather than as a directory, this package won't build with Go 1.8 (see https://travis-ci.org/elastic/apm-agent-go/jobs/507736180).
Can you please add a build constraint for 1.9+ to each of the Go files in this new package? Look for "// +build go1.9" in the files in apmgocql for an example, if you're unfamiliar with doing that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is an awesome idea 👍 I added the build tags in v4
files.
module/apmecho/v4/doc.go
Outdated
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
// Package apmecho provides middleware for the Echo framework, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The package doc needs to be directly before the "package apmecho" line for it to show up in godoc properly. Can you please change it so it looks like this:
// +build go1.9
// Package apmecho...
package apmecho
module/apmecho/go.mod
Outdated
@@ -1,17 +1,13 @@ | |||
module go.elastic.co/apm/module/apmecho |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go.mod and go.sum are still modified, can you please remove the changes from the diff altogether? You can do this by resetting those files to their contents in the master branch:
git reset master go.mod go.sum
git checkout go.mod go.sum
git commit -a -m "Revert changes to go.mod/go.sum"
Thanks @1995parham! There's something going wrong with CI to do with module verification. I think it's a bug in the verification code, and not your changes. I will try to look into it tomorrow. |
@axw Thanks for your time and your reviews. I am available if any changes will need. |
Codecov Report
@@ Coverage Diff @@
## master #477 +/- ##
=========================================
- Coverage 84.41% 83.81% -0.6%
=========================================
Files 112 113 +1
Lines 7095 6795 -300
=========================================
- Hits 5989 5695 -294
Misses 794 794
+ Partials 312 306 -6
Continue to review full report at Codecov.
|
@1995parham the go tool is getting confused by the "v4" path, thinking it signifies a major version path for the apmecho module. The best idea I've come up with is to rename it to "go.elastic.co/apm/module/apmechov4", but I'm open to other ideas if you have any. |
@axw Personally I prefer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a couple of minor changes required.
module/apmechov4/doc.go
Outdated
|
||
// +build go1.9 | ||
|
||
// Package apmecho provides middleware for the Echo framework, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should now be "Package apmechov4 ..."
(golint is complaining)
scripts/Dockerfile-testing
Outdated
@@ -6,6 +6,7 @@ COPY go.mod go.sum /go/src/go.elastic.co/apm/ | |||
COPY internal/tracecontexttest/go.mod internal/tracecontexttest/go.sum /go/src/go.elastic.co/apm/internal/tracecontexttest/ | |||
COPY module/apmbeego/go.mod module/apmbeego/go.sum /go/src/go.elastic.co/apm/module/apmbeego/ | |||
COPY module/apmecho/go.mod module/apmecho/go.sum /go/src/go.elastic.co/apm/module/apmecho/ | |||
COPY module/apmecho/v4/go.mod module/apmecho/v4/go.sum /go/src/go.elastic.co/apm/module/apmecho/v4/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This (and below) needs to be changed from apmecho/v4
to apmechov4
Thanks again for your contribution @1995parham! |
Echo has released its new version with Go module support. Its import path has been changed to
github.com/labstack/echo/v4
and I change it in theapmecho
.