Skip to content

Introduced Go module support as v4, removed obsolete CloseNotifier() #1269

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

Merged
merged 1 commit into from
Jan 30, 2019

Conversation

alexaandru
Copy link
Contributor

This reintroduces support for Go modules, as v4

CloseNotifier() is removed as it has been obsoleted, see https://golang.org/doc/go1.11#net/http
It was already NOT working (not sending signals) as of 1.11, the functionality was gone already, we merely deleted the functions that exposed it. If everyone still rely on it they should migrate to using c.Request().Context().Done() instead.

Closes #1268, #1255

@alexaandru
Copy link
Contributor Author

@vishr @im-kulikov the branch is ready for review. Cheers!

@codecov
Copy link

codecov bot commented Jan 30, 2019

Codecov Report

Merging #1269 into master will increase coverage by 0.25%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1269      +/-   ##
==========================================
+ Coverage   81.63%   81.88%   +0.25%     
==========================================
  Files          26       26              
  Lines        1938     1932       -6     
==========================================
  Hits         1582     1582              
+ Misses        248      242       -6     
  Partials      108      108
Impacted Files Coverage Δ
middleware/logger.go 85.18% <ø> (ø) ⬆️
middleware/csrf.go 76.71% <ø> (ø) ⬆️
response.go 69.44% <ø> (+3.65%) ⬆️
middleware/key_auth.go 71.42% <ø> (ø) ⬆️
middleware/jwt.go 79.48% <ø> (ø) ⬆️
echo.go 87.63% <ø> (ø) ⬆️
middleware/method_override.go 84.61% <ø> (ø) ⬆️
middleware/recover.go 72.72% <ø> (ø) ⬆️
middleware/request_id.go 80% <ø> (ø) ⬆️
middleware/secure.go 92% <ø> (ø) ⬆️
... and 12 more

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 282a44d...33f2dbe. Read the comment docs.

@codecov
Copy link

codecov bot commented Jan 30, 2019

Codecov Report

Merging #1269 into master will increase coverage by 0.25%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1269      +/-   ##
==========================================
+ Coverage   81.63%   81.88%   +0.25%     
==========================================
  Files          26       26              
  Lines        1938     1932       -6     
==========================================
  Hits         1582     1582              
+ Misses        248      242       -6     
  Partials      108      108
Impacted Files Coverage Δ
middleware/logger.go 85.18% <ø> (ø) ⬆️
middleware/csrf.go 76.71% <ø> (ø) ⬆️
response.go 69.44% <ø> (+3.65%) ⬆️
middleware/static.go 66.15% <ø> (ø) ⬆️
middleware/key_auth.go 71.42% <ø> (ø) ⬆️
middleware/jwt.go 79.48% <ø> (ø) ⬆️
echo.go 87.63% <ø> (ø) ⬆️
middleware/method_override.go 84.61% <ø> (ø) ⬆️
middleware/recover.go 72.72% <ø> (ø) ⬆️
middleware/request_id.go 80% <ø> (ø) ⬆️
... and 12 more

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 282a44d...6d9e043. Read the comment docs.

@alexaandru
Copy link
Contributor Author

Oh, for some weird reason, go.sum is NOT generated on my end. No clue why :-) So I could not commit that one. Technically it's only recommended to include it, but not required (it does not act as a lock file, the go.mod has all the information needed to determine the versions to be used). I'd be happy to include it if only I could figure out why is not created... :-)

@im-kulikov
Copy link
Contributor

hm..

go mod tidy
go mod download
go mod verify

And I see go.sum

@alexaandru
Copy link
Contributor Author

Thanks! go mod tidy did it! :-) I committed it now.

@im-kulikov
Copy link
Contributor

im-kulikov commented Jan 30, 2019

echo.go:766

func (ln tcpKeepAliveListener) Accept() (c net.Conn, err error) {
	tc, err := ln.AcceptTCP()
	if err != nil {
		return
	}
	tc.SetKeepAlive(true)
	tc.SetKeepAlivePeriod(3 * time.Minute)
	return tc, nil
}
	tc.SetKeepAlive(true)
	tc.SetKeepAlivePeriod(3 * time.Minute)

can return errors, mb replace it with:

func (ln tcpKeepAliveListener) Accept() (c net.Conn, err error) {
	tc, err := ln.AcceptTCP()
	if err != nil {
		return
	}
	if err = tc.SetKeepAlive(true); err != nil {
                return
        }
	if err = tc.SetKeepAlivePeriod(3 * time.Minute); err != nil {
                return
        }
	return tc, nil
}

middleware/compress.go:112 errors ignored

func (w *gzipResponseWriter) Flush() {
	w.Writer.(*gzip.Writer).Flush()
}

Copy link
Contributor

@im-kulikov im-kulikov left a comment

Choose a reason for hiding this comment

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

LGTM

@alexaandru
Copy link
Contributor Author

Thanks @im-kulikov ! @vishr are we good?

As for your comment, yes, that change looks good to me! But to keep things clean, please open a separate ticket. Also, FWIW it can be simplified a bit:

func (ln tcpKeepAliveListener) Accept() (c net.Conn, err error) {
	if c, err = ln.AcceptTCP(); err != nil {
		return
	}
	if err = c.SetKeepAlive(true); err != nil {
                return
        }
	if err = c.SetKeepAlivePeriod(3 * time.Minute); err != nil {
                return
        }

	return
}

@im-kulikov
Copy link
Contributor

@alexaandru done #1270

@alexaandru
Copy link
Contributor Author

Thank you :) and sorry, looks like we both missed a critical thing... the version :) I'll update mine to 4.0.0 and force push it, and then you'll need to rebase on top of it and call it 4.0.1

…mechanism

This reintroduces support for Go modules, as v4.

CloseNotifier() is removed as it has been obsoleted, see https://golang.org/doc/go1.11#net/http

It was already NOT working (not sending signals) as of 1.11 the functionality was gone, we merely
deleted the functions that exposed it. If anyone still relies on it they should migrate to using
`c.Request().Context().Done()` instead.

Closes #1268, #1255
@im-kulikov
Copy link
Contributor

@alexaandru done

@alexaandru
Copy link
Contributor Author

Alright then, I reviewed it one more time, you reviewed it @im-kulikov , CI is happy. I'm merging it :-)

@alexaandru alexaandru merged commit 6d9e043 into master Jan 30, 2019
@alexaandru alexaandru deleted the v4-preview branch January 30, 2019 14:30
@im-kulikov
Copy link
Contributor

my PR was based on your.. I fix it - #1271

@alexaandru
Copy link
Contributor Author

Odd, I know it was based off of that, but the commit did not change (well, after the 4.0.0 change, that is). The merging simply fast forwarded master on top of that commit, but the SHA didn't change. Your PR should've been unaffected. Sorry for the trouble @im-kulikov :(

@im-kulikov
Copy link
Contributor

don't worry, I quickly corrected it

@alexaandru
Copy link
Contributor Author

Thanks! :)

@vishr
Copy link
Member

vishr commented Jan 30, 2019

You guys rock!

@alexaandru
Copy link
Contributor Author

We're just having fun with our favorite web framework ;-) Cheers!

@vishr
Copy link
Member

vishr commented Jan 30, 2019

@alexaandru On Gitter someone is having problem with v4, can you address that?

This is new and it's a blocker:
package github.com/labstack/echo/v4: cannot find package "github.com/labstack/echo/v4" in any of:
/usr/lib/go-1.10/src/github.com/labstack/echo/v4 (from $GOROOT)
/var/lib/jenkins/jobs/customermanagement/builds/11/src/github.com/labstack/echo/v4 (from $GOPATH)

@im-kulikov
Copy link
Contributor

im-kulikov commented Jan 30, 2019

@vishr @alexaandru /usr/lib/go-1.10 mb problem in that?

@im-kulikov
Copy link
Contributor

I'm not sure, that suffix would work with less than go1.11

@alexaandru
Copy link
Contributor Author

@vishr @im-kulikov the Go requirements I took straight from Go wiki: https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher I really think they would be the ones to know best which Go version supports what... If they have a Go 1.10 version below 1.10.3, then yes, it will not work. If however they have at least 1.10.3, then it should work.

They should either upgrade their Go OR stick to Echo v3.3.10. Removing support for Go modules should really be our last option (I hope)... Thoughts?

@vishr
Copy link
Member

vishr commented Jan 30, 2019

@vishr @im-kulikov the Go requirements I took straight from Go wiki: https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher I really think they would be the ones to know best which Go version supports what... If they have a Go 1.10 version below 1.10.3, then yes, it will not work. If however they have at least 1.10.3, then it should work.

They should either upgrade their Go OR stick to Echo v3.3.10. Removing support for Go modules should really be our last option (I hope)... Thoughts?

I agree, the guy is using v3.3.9 now - which works.

@alexaandru
Copy link
Contributor Author

Can we at least get the go version that they're using?

@vishr
Copy link
Member

vishr commented Jan 30, 2019

Can we at least get the go version that they're using?

From the logs it seems Go 1.10.x

@alexaandru
Copy link
Contributor Author

Well, it's that tiny x that matters the most in this case :-)

@vishr
Copy link
Member

vishr commented Jan 30, 2019

Well, it's that tiny x that matters the most in this case :-)

Not sure.

@vishr
Copy link
Member

vishr commented Jan 30, 2019

It is ok until someone else complains ;)

@alexaandru
Copy link
Contributor Author

In all fairness, the only ones complaining are the ones that have the least reasons: the ones that do not use any dependency management at all. We did release a MAJOR version. Major versions break things. Everywhere, not just in our project. If someone does not like their project to be broken, they should use a dependency management mechanism. Or read the Release Notes... Just sayin'...

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