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

Updates echo package version to v4. #477

Merged
merged 11 commits into from
Mar 19, 2019
Merged

Updates echo package version to v4. #477

merged 11 commits into from
Mar 19, 2019

Conversation

1995parham
Copy link
Contributor

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 the apmecho.

@axw
Copy link
Member

axw commented Mar 18, 2019

@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 apmecho/v4, which is a copy of apmecho but with the import paths changed?

@1995parham
Copy link
Contributor Author

I agree with your idea, we can create apmecho/v4 that works with version 4 of echo and save apmecho for backward compatibility. I try to do it in this PR and let you know.

@1995parham
Copy link
Contributor Author

@axw I tried to provide a separate module for version 4 of Echo.

Copy link
Member

@axw axw left a 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.

@@ -1,17 +1,13 @@
module go.elastic.co/apm/module/apmecho
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I forgot that.

Copy link
Member

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"

package apmecho_test

import (
"github.com/labstack/echo/v4"
Copy link
Member

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.

Copy link
Contributor Author

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.

// specific language governing permissions and limitations
// under the License.

// Package apmecho provides middleware for the Echo framework,
Copy link
Member

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

@@ -1,17 +1,13 @@
module go.elastic.co/apm/module/apmecho
Copy link
Member

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"

@axw
Copy link
Member

axw commented Mar 18, 2019

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.

@1995parham
Copy link
Contributor Author

@axw Thanks for your time and your reviews. I am available if any changes will need.

@codecov-io
Copy link

codecov-io commented Mar 18, 2019

Codecov Report

Merging #477 into master will decrease coverage by 0.59%.
The diff coverage is 85.48%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
module/apmechov4/middleware.go 85.48% <85.48%> (ø)
gocontext.go 84.09% <0%> (-12.21%) ⬇️
error.go 94.88% <0%> (-2.61%) ⬇️
tracer.go 86.09% <0%> (-1.3%) ⬇️
span.go 86.82% <0%> (-0.95%) ⬇️
transaction.go 94.64% <0%> (-0.36%) ⬇️
modelwriter.go 95.93% <0%> (+0.83%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3c9177c...429791a. Read the comment docs.

@axw
Copy link
Member

axw commented Mar 19, 2019

@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.

@1995parham
Copy link
Contributor Author

@axw Personally I prefer /v4 but because of issues I think creates another top-level module is the only way. I will try it and let you know. Again thanks for your time.

Copy link
Member

@axw axw left a 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.


// +build go1.9

// Package apmecho provides middleware for the Echo framework,
Copy link
Member

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)

@@ -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/
Copy link
Member

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

@axw axw merged commit 4378ed2 into elastic:master Mar 19, 2019
@axw
Copy link
Member

axw commented Mar 19, 2019

Thanks again for your contribution @1995parham!

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

Successfully merging this pull request may close these issues.

3 participants